You are here

function realname_admin_bypass in Real Name 6

Same name and namespace in other branches
  1. 5 realname.module \realname_admin_bypass()
1 string reference to 'realname_admin_bypass'
realname_menu in ./realname.module
Implements hook_menu().

File

./realname.admin.inc, line 161
The RealName module allows the admin to choose fields from the user profile that will be used to add a "realname" element (method) to a user object. Hook_user is used to automatically add this to any user object that is loaded.

Code

function realname_admin_bypass() {
  $form = array();
  $current = variable_get('realname_bypass_forms', array(
    array(
      'name' => 'comment_form',
      'fields' => array(
        'name',
      ),
    ),
  ));
  $rows = count($current);
  $bypass_list = NULL;
  foreach ($current as $bypass) {
    $bypass_list .= $bypass['name'] . ' ' . implode(' ', $bypass['fields']) . "\n";
  }
  $form['warning'] = array(
    '#type' => 'markup',
    '#value' => '<div class="messages warning">' . t('<strong>WARNING</strong>: This form may cause errors if the instructions below are not followed or if you give an invalid form name or field name. Please do not remove the "comment_form" line.') . '</div>',
  );
  $form['bypass_forms'] = array(
    '#type' => 'textarea',
    '#title' => t('Bypass these forms'),
    '#rows' => max(array(
      $rows + 1,
      5,
    )),
    '#default_value' => $bypass_list,
    '#description' => t('Enter one form per line. Each line should start with the form name. That should be followed by the name of the field to be reset to the username. If the field is a child field, include its full parent path, separated by spaces. For example: mymodule_form fieldset_1 fieldset_2 name'),
    '#required' => TRUE,
  );
  $form['submit'] = array(
    '#type' => 'submit',
    '#value' => t('Bypass these forms'),
  );
  return $form;
}