You are here

function discussthis_form_alter in Discuss This! 7.2

Same name and namespace in other branches
  1. 5 discussthis.module \discussthis_form_alter()
  2. 6 discussthis.module \discussthis_form_alter()
  3. 7 discussthis.module \discussthis_form_alter()

Implements hook_form_alter().

Adds per-node override forum dropdown and topic autocomplete form for node edit forms.

File

./discussthis.module, line 131
Associations discussions in forums with specific nodes

Code

function discussthis_form_alter(&$form, &$form_state, $form_id) {

  //
  if ($form_id == 'forum_node_form' && !empty($form_state['discussthis']['post'])) {

    // we need to tweak forum forms to make sure that captcha do not
    // both us when we're auto-posting a new entry in the forum
    // if the user has a captcha on the forum, we need to add a dummy entry
    if (module_exists('captcha') && (arg(0) != 'admin' || variable_get('captcha_allow_on_admin_pages', FALSE)) && !user_access('skip CAPTCHA')) {
      module_load_include('inc', 'captcha');
      $captcha_point = captcha_get_form_id_setting('forum_node_form');
      if ($captcha_point && $captcha_point->type) {

        // the captcha type is set to none so it will be ignored
        $form['buttons']['captcha']['#captcha_type'] = 'none';
      }
    }
  }
}