You are here

function regcode_roles_admin in Registration codes 6

Same name and namespace in other branches
  1. 6.2 regcode_roles/regcode_roles.module \regcode_roles_admin()
  2. 7.2 regcode_roles/regcode_roles.module \regcode_roles_admin()
  3. 7 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
Implementation of hook_menu()

File

regcode_roles/regcode_roles.module, line 72

Code

function regcode_roles_admin() {
  $form = array();
  $form['regcode_roles']['new'] = array(
    '#type' => 'fieldset',
    '#title' => 'Create a new rule',
  );
  $form['regcode_roles']['new']['role'] = array(
    '#type' => 'select',
    '#title' => 'Assign role',
    '#options' => user_roles(),
  );
  $form['regcode_roles']['new']['category'] = array(
    '#type' => 'select',
    '#title' => 'When a user uses a regcode in category',
    '#options' => regcode_get_categories(),
  );
  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(
    '#type' => 'markup',
    '#value' => regcode_roles_get_list_markup(),
  );
  return $form;
}