function _book_access_options_restrict in Book access 6
Restricts the options available to who moves book pages between books.
We don't want users to be able to add child pages to pages they do not have update grants for; therefore, we remove select options which point to book pages user does not have that grant.
Parameters
$options: The options array used from book_outline_form() and the book edit form for the list of books to which the page can be moved to.
See also
1 call to _book_access_options_restrict()
- book_access_form_alter in ./
book_access.module - Implements hook_form_alter().
File
- ./
book_access.module, line 503 - Allows access control for book nodes on a per book basis. It is based on forum_access.module and tac_lite.module.
Code
function _book_access_options_restrict(&$options) {
if (user_access('administer nodes')) {
return;
}
$permitted_bids = _book_access_user_books_list('update');
if (isset($options)) {
foreach ($options as $bid => $value) {
if ($bid > 0 && !isset($permitted_bids[$bid])) {
unset($options[$bid]);
}
}
}
}