You are here

function user_badges_roles_form in User Badges 5

Same name and namespace in other branches
  1. 6.2 user_badges.admin.inc \user_badges_roles_form()
  2. 6 user_badges.admin.inc \user_badges_roles_form()
  3. 7.4 includes/user_badges.admin.inc \user_badges_roles_form()
  4. 7 user_badges.admin.inc \user_badges_roles_form()
  5. 7.2 user_badges.admin.inc \user_badges_roles_form()
  6. 7.3 user_badges.admin.inc \user_badges_roles_form()
1 string reference to 'user_badges_roles_form'
user_badges_menu in ./user_badges.module
Implementation of hook_menu().

File

./user_badges.module, line 495
@brief User Badges module file

Code

function user_badges_roles_form() {
  $roles = user_roles();
  $badges = user_badges_get_roles();
  $selects = array(
    '' => 'inactive',
  ) + user_badges_get_badges('select');
  $form['blocked'] = array(
    '#type' => 'fieldset',
    '#title' => t('Blocked user badge'),
    '#collapsible' => TRUE,
    '#collapsed' => TRUE,
    '#tree' => TRUE,
  );
  $form['blocked'][0] = array(
    '#type' => 'select',
    '#default_value' => $badges[0],
    '#options' => $selects,
  );
  $form['roles'] = array(
    '#tree' => TRUE,
  );
  foreach ($roles as $rid => $role) {
    if ($rid != 1) {

      // no badges for the anonymous role
      $form['roles'][$rid] = array(
        '#type' => 'select',
        '#title' => $role,
        '#default_value' => $badges[$rid],
        '#options' => $selects,
      );
    }
  }
  $form[] = array(
    '#type' => 'submit',
    '#value' => t('Save Roles'),
  );
  return $form;
}