You are here

function theme_realname_new_role in Real Name 6

Theme the new-role form (copied from user.admin.inc.

1 string reference to 'theme_realname_new_role'
realname_theme_registry_alter in ./realname.module
An Implements hook_theme_registry_alter()

File

./realname_theme.inc, line 141
This include file intercepts the theme('username'... function and uses the RealName instead of the username.

Code

function theme_realname_new_role($form) {
  $header = array(
    t('Name'),
    t('User level'),
    array(
      'data' => t('Operations'),
      'colspan' => 2,
    ),
  );
  foreach (user_roles() as $rid => $name) {
    $pic = variable_get('realname_user_level_' . $rid, '');
    $level = empty($pic) ? '' : '<img src="' . file_create_url($pic) . '" />';
    $edit_permissions = l(t('edit permissions'), 'admin/user/permissions/' . $rid);
    if (!in_array($rid, array(
      DRUPAL_ANONYMOUS_RID,
      DRUPAL_AUTHENTICATED_RID,
    ))) {
      $rows[] = array(
        $name,
        $level,
        l(t('edit role'), 'admin/user/roles/edit/' . $rid),
        $edit_permissions,
      );
    }
    else {
      $rows[] = array(
        $name,
        $level,
        t('locked'),
        $edit_permissions,
      );
    }
  }
  $rows[] = array(
    drupal_render($form['name']),
    array(
      'data' => drupal_render($form['submit']),
      'colspan' => 3,
    ),
  );
  $output = drupal_render($form);
  $output .= theme('table', $header, $rows);
  return $output;
}