Posted by Neodym on February 17, 2009 at 10:09pm
| Project: | Book access |
| Version: | 6.x-1.x-dev |
| Component: | Code |
| Category: | feature request |
| Priority: | normal |
| Assigned: | Unassigned |
| Status: | closed (fixed) |
Issue Summary
Hi everyone!
I've just created a patch to fix the appearance of the "Outline" tab and the "Add Child Page" link on book pages of books without update permission of the current user.
Patch is build against latest release 6.x-1.0-rc2.
I'm sorry if I made a mistake, this is my first patch and contribution.
Thank you,
Neodym
| Attachment | Size |
|---|---|
| book_access_add_link_outline_tab_fix.patch | 4.02 KB |
Comments
#1
Hi, it's me again.
Discard the patch above, this one is the real version. Tested against latest Drupal 6.9 release.
So long,
Neodym
PS: Why is it not possible to edit one's own filed issue?
#2
Thanks for this, I've modified this patch to "fix" the "Add child page" link display for D5 with a slightly simplified version.
#3
The patch should be created for the development snapshot.
The patch as it is doesn't follow the coding standards; then, the code that changes the access callback of the menu should also change the access arguments.
#4
The development snapshot already has the code to remove the link ; therefore that part of the patch is not necessary.
<?php
$bool = (
$grant_update && (
user_access('add content to books') ||
user_access('administer book outlines')
) &&
node_access('create', variable_get('book_child_type', 'book')) &&
$node->status == 1 &&
$node->book['depth'] < MENU_MAX_DEPTH
);
if (!$bool) {
// Remove the link "add child page".
unset($node->links['book_add_child']);
}
break;
?>
#5
I started to change the code added by the patch, and applying it in chunks.
For now, I moved the code that was in
hook_nodeapi()intohook_menu_link_alter(); I also updated the code that verifies if the user has the permission to update the book as granted by the realm book_access_rule.#6
I added the rest of the code, after I changed it to follow more the coding standards, and after I fixed the code (removing a book page from a book doesn't mean to delete it).
Thanks for the report, and the help with the code.
#7
Automatically closed -- issue fixed for 2 weeks with no activity.