You are here

public function BotchaRecipebook::isApplicable in BOTCHA Spam Prevention 7.3

Same name and namespace in other branches
  1. 6.3 controller/recipebook/botcha.recipebook.controller.inc \BotchaRecipebook::isApplicable()

File

controller/recipebook/botcha.recipebook.controller.inc, line 115
Controller layer of the BotchaRecipebook objects.

Class

BotchaRecipebook

Code

public function isApplicable($form, $form_state) {
  $form_id = $form['form_id']['#value'];
  $isApplicable = FALSE;
  if (!user_access('skip BOTCHA')) {
    $isApplicable = TRUE;
  }
  switch ($form_id) {
    case 'user_register':

      // Only change the registration form. There is also 'user_register' form
      // at /admin/config/people/user/create path, but we leave it alone.
      if (FALSE === strpos($form['#action'], 'user/register')) {
        if (!variable_get('botcha_allow_on_admin_pages', FALSE)) {
          $isApplicable = FALSE;
        }
      }
      break;
  }
  return $isApplicable;
}