function content_access_user_admin_perm_submit in Content Access 6
Same name and namespace in other branches
- 8 content_access.module \content_access_user_admin_perm_submit()
- 7 content_access.admin.inc \content_access_user_admin_perm_submit()
Submit callback for the user permissions form. Trigger changes to node permissions to rebuild our grants.
1 string reference to 'content_access_user_admin_perm_submit'
- content_access_form_alter in ./
content_access.module - Implementation of hook_form_alter().
File
- ./
content_access.admin.inc, line 364 - Content access administration UI.
Code
function content_access_user_admin_perm_submit($form, $form_state) {
// Check for each content type, which has per node access activated
// whether permissions have been changed.
$types = array();
foreach (array_filter(content_access_get_settings('per_node')) as $type => $value) {
foreach (_content_access_get_node_permissions($type) as $perm) {
foreach (user_roles() as $rid => $role) {
if (isset($form_state['values'][$rid]) && in_array($perm, $form['checkboxes'][$rid]['#default_value']) != in_array($perm, $form_state['values'][$rid])) {
//permission changed!
$types[$type] = node_get_types('name', $type);
continue 2;
}
}
}
}
if ($types && content_access_mass_update(array_keys($types))) {
drupal_set_message(format_plural(count($types), 'Permissions have been successfully rebuilt for the content type @types.', 'Permissions have been successfully rebuilt for the content types @types.', array(
'@types' => implode(', ', $types),
)));
}
}