function adminrole_install in Admin role 5
Same name and namespace in other branches
- 6 adminrole.install \adminrole_install()
- 7 adminrole.install \adminrole_install()
Implements hook_install().
File
- ./
adminrole.install, line 11 - Install, update and uninstall functions for the adminrole module.
Code
function adminrole_install() {
// Check if there is an existing 'admin' named role. If so, do not add a new
// administrator role.
$rid = db_result(db_query_range("SELECT 1 FROM {role} WHERE name LIKE 'admin%%'", 0, 1));
if (!$rid) {
db_query("INSERT INTO {role} (name) VALUES ('%s')", 'administrator');
$rid = db_result(db_query("SELECT rid FROM {role} WHERE name = 'administrator'"));
variable_set('user_admin_role', $rid);
drupal_set_message(t('A new user role of <em>administrator</em> has been added. Its permissions will be automatically managed by the Admin role module.'));
}
}