Right now, admin_menu_output() uses the following pattern to generate a unique $cid string:

  $cid = 'admin_menu:' . $user->uid . ':' . session_id() . ':' . $language->language;

But there are instances in which a user may have differing sets of administrative options even within the same session. With Domain Access, for example, a user could have content publishing options that change from domain to domain. It would be nice if modules could add to the $cid pattern in this kind of instance.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

Les Lim’s picture

Status: Active » Needs review
FileSize
1.3 KB

Patch attached.

MrHaroldA’s picture

Assigned: Unassigned » MrHaroldA
Issue summary: View changes
Status: Needs review » Needs work

The proposed solution does not work: the $cid is created in at least 2 places, and the call to domain_get_domain() will result in fatal errors on sites without the Domain Access module enabled.

I'll try to create a working patch today. Or something like that ;)

MrHaroldA’s picture

Status: Needs work » Needs review
FileSize
2.36 KB

Here ya go!

I've recreated the patch above; this time with no direct Domains support, as that is a task for the Domain Access module, or you can implement the following code yourself:

/**
 * Implements hook_admin_menu_cache_cid_alter().
 */
function MY_MODULE_admin_menu_cache_cid_alter(&$cid) {
  $domain = domain_get_domain();
  $cid .= ':' . $domain['domain_id'];
}
Les Lim’s picture

Status: Needs review » Needs work

@MrHaroldA: That domain code was part of the api.php documentation file, as an example implementation of the new hook. I think the patch still needs some kind of example hook there.

MrHaroldA’s picture

Ah! That explains why the tests didn't fail ;)

Greg__’s picture

I tested the patch and it works for me.
I had the same issue with cache between domain so I did use the hook exemple in #3.
Thanks

truls1502’s picture

Status: Needs work » Postponed (maintainer needs more info)
Issue tags: +postponed2w

I am sorry for no reply until now.

There are many issues regarding this module admin_menu which is a bit difficult for us to follow up since some of the issues might be already outdated, or is already fixed by the module or any other modules or itself core which means that the problem might no longer need to be fixed.

We can see that the issue has been created for a few years ago, I hope it is okay for you that I am postponing the issue, and give you around two weeks. If you still face the problem, could you tell us the step by step when until you get the error message or what is frustrated you, and a list of modules you are using related to admin_menu and a screenshot that might help us? So it makes us easier to reproduce your issue.

However, after two weeks with no feedback - we will close this issue. So in case, you noticed it after the issue is closed, do not hesitate to reopen it like and fill information which is mentioned above.

So before giving us a feedback, do you mind to test it again with our latest 7.x-3.x-dev?

Thank you for understanding! :)

truls1502’s picture

Status: Postponed (maintainer needs more info) » Closed (cannot reproduce)
Issue tags: -postponed2w

This issue has been automatically marked as closed because it has not had recent activity after the last post.

However, if you or someone is still facing the same issue as described to the issue, could you please to re-open the issue by changing the status of the issue, and add an explanation with more details which can help us to reproduce your situation.

Again, thank you for your contributions! :)