function user_admin_role_submit in Drupal 6
Same name and namespace in other branches
- 5 modules/user/user.module \user_admin_role_submit()
- 7 modules/user/user.admin.inc \user_admin_role_submit()
1 string reference to 'user_admin_role_submit'
- user_admin_role in modules/
user/ user.admin.inc - Menu callback: administer roles.
File
- modules/
user/ user.admin.inc, line 701 - Admin page callback file for the user module.
Code
function user_admin_role_submit($form, &$form_state) {
if ($form_state['values']['op'] == t('Save role')) {
db_query("UPDATE {role} SET name = '%s' WHERE rid = %d", $form_state['values']['name'], $form_state['values']['rid']);
drupal_set_message(t('The role has been renamed.'));
}
else {
if ($form_state['values']['op'] == t('Delete role')) {
db_query('DELETE FROM {role} WHERE rid = %d', $form_state['values']['rid']);
db_query('DELETE FROM {permission} WHERE rid = %d', $form_state['values']['rid']);
// Update the users who have this role set:
db_query('DELETE FROM {users_roles} WHERE rid = %d', $form_state['values']['rid']);
drupal_set_message(t('The role has been deleted.'));
}
else {
if ($form_state['values']['op'] == t('Add role')) {
db_query("INSERT INTO {role} (name) VALUES ('%s')", $form_state['values']['name']);
drupal_set_message(t('The role has been added.'));
}
}
}
$form_state['redirect'] = 'admin/user/roles';
return;
}