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

Comments

Neodym’s picture

StatusFileSize
new3.98 KB

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?

pfaocle’s picture

Thanks for this, I've modified this patch to "fix" the "Add child page" link display for D5 with a slightly simplified version.

avpaderno’s picture

Version: 6.x-1.0-rc2 » 6.x-1.x-dev
Status: Needs review » Needs work

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.

avpaderno’s picture

The development snapshot already has the code to remove the link Add child page; therefore that part of the patch is not necessary.

      $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;
avpaderno’s picture

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() into hook_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.

avpaderno’s picture

Status: Needs work » Fixed

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.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.