function user_user_roles_form_submit
Search API
7.x user.module | user_user_roles_form_submit($form, $form_state) |
6.x user.module | user_user_roles_form_submit($form, $form_state) |
4.x user.module | user_user_roles_form_submit($form, $form_state) |
5.x user.module | user_user_roles_form_submit($form, $form_state) |
File
- modules/
user/ user.module, line 444
Code
function user_user_roles_form_submit($form, $form_state) {
$values = $form_state ["values"];
if (trim($values ["new_role"]) != "") {
$new_role = strtolower(trim($values ["new_role"]));
// Clean up any trouble chars
$new_role = preg_replace("/[^a-zA-Z0-9_]/", " ", $new_role);
// Okay, add to the roles table.
db_query("INSERT INTO roles (name) VALUES ('?') ", $new_role);
fp_add_message("The new role has been added successfully.");
}
if (strstr($values ["perform_action2"], "del~_~")) {
$temp = explode("~_~", $values ["perform_action2"]);
$i = trim($temp [1]);
// Remove this rid from the table.
db_query("DELETE FROM roles WHERE rid = '?' ", $i);
fp_add_message("The role has been deleted successfully.");
}
if (strstr($values ["perform_action2"], "edit~_~")) {
$temp = explode("~_~", $values ["perform_action2"]);
$i = trim($temp [1]);
$new_name = strtolower(trim($temp [2]));
$new_name = preg_replace("/[^a-zA-Z0-9_]/", " ", $new_name);
if (trim($new_name) != "") {
// Let's update the table.
db_query("UPDATE roles SET name = '?' WHERE rid = '?' ", $new_name, $i);
fp_add_message("The role has been edited successfully.");
}
}
}