function book_access_ui_user_add_submit in Book access 7.2
Same name and namespace in other branches
- 6.2 book_access_ui.admin.inc \book_access_ui_user_add_submit()
Form submission callback for book_access_ui_grants_form().
See also
1 string reference to 'book_access_ui_user_add_submit'
- book_access_ui_grants_form in ./
book_access_ui.admin.inc - Form builder for the book access configuration page.
File
- ./
book_access_ui.admin.inc, line 288 - Administration interface for the Book access module.
Code
function book_access_ui_user_add_submit($form, &$form_state) {
$bool = ($username = trim($form_state['values']['user']['username'])) && ($user = user_load_by_name($username));
if ($bool) {
$grants = array();
$uid = $user->uid;
$grants['grant_view'][$uid] = $form_state['values']['user']['grant_view'];
$grants['grant_update'][$uid] = $form_state['values']['user']['grant_update'];
$grants['grant_delete'][$uid] = $form_state['values']['user']['grant_delete'];
$grants['grant_admin_access'][$uid] = $form_state['values']['user']['grant_admin_access'];
$grants['grant_add_child'][$uid] = $form_state['values']['user']['grant_add_child'];
$grants['grant_edit_outline'][$uid] = $form_state['values']['user']['grant_edit_outline'];
BookAccess::addUserGrants($form['#bid'], array(
$uid,
), $grants);
_book_access_ui_permissions_warning();
}
elseif ($username) {
drupal_set_message(t("User %user has not been found.", array(
'%user' => $username,
)), 'error');
}
}