| 1 |
<?php |
<?php |
| 2 |
// $Id: adminrole.module,v 1.2.2.8.2.1 2008/07/28 18:10:32 jacobsingh Exp $ |
// $Id: adminrole.module,v 1.2.2.8.2.2 2008/08/06 17:36:34 jacobsingh Exp $ |
| 3 |
|
|
| 4 |
/** @file |
/** @file |
| 5 |
* adminrole: |
* adminrole: |
| 13 |
function adminrole_help($section) { |
function adminrole_help($section) { |
| 14 |
switch ($section) { |
switch ($section) { |
| 15 |
case 'admin/user/adminrole': |
case 'admin/user/adminrole': |
| 16 |
return t('Change which role is a "admin" Role with full perms'); |
return t('Change which role is an "administrator" role with full permissions'); |
| 17 |
} |
} |
| 18 |
} |
} |
| 19 |
|
|
| 25 |
|
|
| 26 |
$items['admin/user/adminrole'] = array( |
$items['admin/user/adminrole'] = array( |
| 27 |
'title' => t('Admin Role'), |
'title' => t('Admin Role'), |
| 28 |
'description' => t('Change which role is a "admin" Role with full perms'), |
'description' => t('Change which role is an "administrator" role with full permissions'), |
| 29 |
'page callback' => 'drupal_get_form', |
'page callback' => 'drupal_get_form', |
| 30 |
'page arguments' => array('adminrole_admin_settings'), |
'page arguments' => array('adminrole_admin_settings'), |
| 31 |
'access arguments' => array('administer site configuration'), |
'access arguments' => array('administer site configuration'), |
| 61 |
} |
} |
| 62 |
} |
} |
| 63 |
|
|
| 64 |
function adminrole_admin_settings() { |
function adminrole_admin_settings() { |
| 65 |
$form = array(); |
$form = array(); |
| 66 |
$u_roles = user_roles(); |
|
| 67 |
ksort($u_roles); |
$u_roles = user_roles(); |
| 68 |
$form['adminrole_adminrole'] = array( |
// Removing Authenticated and anonymous roles |
| 69 |
'#type' => 'select', |
unset($u_roles[1]); |
| 70 |
'#title' => t('Admin Roles'), |
unset($u_roles[2]); |
| 71 |
'#default_value' => variable_get('adminrole_adminrole', 0), |
|
| 72 |
'#description' => t("Which Role is Admin?"), |
$u_roles[0] = t('-- Please Select One --'); |
| 73 |
'#options' => array_merge(array(0 => t('-- Please Select One --')), $u_roles), |
ksort($u_roles); |
| 74 |
); |
|
| 75 |
return system_settings_form($form); |
$form['adminrole_adminrole'] = array( |
| 76 |
} |
'#type' => 'select', |
| 77 |
|
'#title' => t('Admin Roles'), |
| 78 |
|
'#default_value' => variable_get('adminrole_adminrole', 0), |
| 79 |
|
'#description' => t("Which role should get all permissions?"), |
| 80 |
|
'#options' => $u_roles, |
| 81 |
|
); |
| 82 |
|
return system_settings_form($form); |
| 83 |
|
} |
| 84 |
|
|
| 85 |
|
|
| 86 |
function adminrole_form_alter(&$form, $form_state, $form_id) { |
function adminrole_form_alter(&$form, $form_state, $form_id) { |