You are here

function regcode_roles_admin in Registration codes 7

Same name and namespace in other branches
  1. 6.2 regcode_roles/regcode_roles.module \regcode_roles_admin()
  2. 6 regcode_roles/regcode_roles.module \regcode_roles_admin()
  3. 7.2 regcode_roles/regcode_roles.module \regcode_roles_admin()

Admin page for role assignment.

1 string reference to 'regcode_roles_admin'
regcode_roles_menu in regcode_roles/regcode_roles.module
Implements hook_menu().

File

regcode_roles/regcode_roles.module, line 72
Main functionality of regcode_role module.

Code

function regcode_roles_admin($form, &$form_state) {
  $form = array();
  $form['regcode_roles']['new'] = array(
    '#type' => 'fieldset',
    '#title' => 'Create a new rule',
  );
  $form['regcode_roles']['new']['role_id'] = array(
    '#type' => 'select',
    '#options' => user_roles(TRUE),
    '#prefix' => '<h4>' . t('When a user uses a regcode with tag'),
    '#title' => t('Role to assign'),
  );
  $form['regcode_roles']['new']['term_id'] = array(
    '#type' => 'select',
    '#required' => TRUE,
    '#title' => t('tag'),
    '#title_display' => 'invisible',
    '#prefix' => '<h4>' . t('When a user uses a regcode with tag'),
    '#options' => regcode_get_vocab_terms(),
  );
  if (module_exists('role_expire')) {
    $form['regcode_roles']['new']['expiry_duration'] = array(
      '#type' => 'textfield',
      '#title' => 'Which expires in (number of days)',
    );
    $form['regcode_roles']['new']['expiry_date'] = array(
      '#type' => 'textfield',
      '#title' => 'Or expires on (fixed date)',
    );
  }
  $form['regcode_roles']['new']['submit'] = array(
    '#type' => 'submit',
    '#value' => 'Create rule',
  );
  $form['regcode_roles']['list'] = array(
    '#markup' => regcode_roles_get_list_markup(),
  );
  return $form;
}