function user_permissions_form_submit
Search API
7.x user.module | user_permissions_form_submit($form, $form_submit) |
6.x user.module | user_permissions_form_submit($form, $form_submit) |
4.x user.module | user_permissions_form_submit($form, $form_submit) |
5.x user.module | user_permissions_form_submit($form, $form_submit) |
Submit handler for the permissions form.
File
- modules/
user/ user.module, line 349
Code
function user_permissions_form_submit($form, $form_submit) {
$values = $form_submit ["values"];
// We should begin by truncating our permissions table, then re-inserting
// everything we get from this submission.
db_query("TRUNCATE TABLE role_permissions");
// Find all the perm checkboxes.
foreach ($values as $key => $val) {
if (strstr($key, "perm_cb_")) {
if (is_array($val)) {
$cb = current($val);
if (strstr($cb, "___")) {
$temp = explode("___", $cb);
$rid = $temp [0];
$perm = $temp [1];
// Okay, save this to our table.
db_query("INSERT INTO role_permissions (rid, perm)
VALUES ('?', '?') ", $rid, $perm);
}
}
}
}
fp_add_message(t("Permissions saved successfully."));
}