0

I have a page manager page for user/%user/edit.

This page has a selection rule, for which I wrote a ctools access plugin.

(In my case the selection rule checks if the logged in user is the owner of an organic group, and the user being viewed is a member of that group).

The problem I have is that I get access denied.

In the debugger, the code does not even touch the ctools access plugin. It just checks if the user role has permission 'administer users'. The role doesn't have this permission, so I get access denied.

Interestingly, if I give the role the 'administer users' permission, then the code in my ctools access plugin runs!

In other words, page_manager_user_edit_page() is hit when the user has permission to get to the page anyway. What I need to happen is for page_manager_user_edit_page() to be hit always, because of course my og owners do not have global 'administer users' permission.

EDIT:

I ended up fixing the problem using hook_menu_alter() to call the function in the ctools access plugin.

In my case, it looks like this - I have a custom module (sites/all/modules/custom/og_user_admin/og_user_admin.module) where I call the access function.

 function og_user_admin_menu_alter(&$items) {
   $items['user/%user/edit']['access callback'] = 'og_user_admin_access_edit_callback';
 }

1 Answer 1

0

use context rule in page manager page.

Home » Administration » Structure » Pages-> selection rule-> from drop down select role-> add-> assign role(selecting by check box).

done.

2
  • Yes that should work, but in my case it doesn't. Not sure why. The entire page_manager page was not being executed, until I set the hook_menu_alter access callback to give the user access to the page at the Drupal level. Then page_manager kicks in for me.
    – mcaleaa
    Feb 29, 2016 at 9:42
  • first remove access callback for the node, and check if there is any access moderation on content type setting from Drupal UI. and more thing you are using og module, cross check that is there any access moderation in OG group setting. Mar 1, 2016 at 13:04

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.