You are here

function captcha_after_db_get_form in CAPTCHA After 7

Same name and namespace in other branches
  1. 6 captcha_after.module \captcha_after_db_get_form()

Loads captcha_after form settings from database.

Parameters

$form_id: Form id value.

Return value

array Array of all captcha_after form settings if they exist in database or FALSE.

1 call to captcha_after_db_get_form()
captcha_after_get_forms_settings in ./captcha_after.module
Helper function for returning captcha_after forms configuration values.

File

./captcha_after.module, line 237
Show CAPTCHA protection on selected forms after specified number of unsuccessful form submit attempts has been made.

Code

function captcha_after_db_get_form($form_id) {
  static $forms = array();
  if (!isset($forms[$form_id])) {
    $form = db_query('SELECT * FROM {captcha_after} WHERE form_id = :form_id', array(
      ':form_id' => $form_id,
    ))
      ->fetchAssoc();
    if (!empty($form)) {
      $form['options'] = empty($form['options']) ? $form['options'] : unserialize($form['options']);
      $forms[$form_id] = $form;
    }
    else {
      $forms[$form_id] = FALSE;
    }
  }
  return $forms[$form_id];
}