Hello,

I have created a menu link 'user/[user-id]/favorites' and its working. But I wanna show this menu item only to authenticated users so I have installed the menu per role, menu access and menu permission modules, the problem is that every time I use a token in my menu item it is not recognized by the permissions modules (of any of them)

Comments

dizarter’s picture

Try changing module weights, and see if that helps.

beumont’s picture

what do you mean by that ?

dealancer’s picture

This means if those modules use same hook, to do something menu item they need to be executed in proper order. Order is stored in modules table in database. The easy way to change that order is to use Weight module http://drupal.org/project/weight.

I don't know if it helps, but try to make menu_token to be before those modules or after, and reports us results.

oskar_calvo’s picture

Hello I find the same problem.

My solution is to enable the util module, and give this:
menu per role : weight 5
token menu : weight 0

It's works now

Thanks

Oskar

SchwebDesign’s picture

thanks oskar_calvo, i used this solution as well and so far so good

hookdump’s picture

Thank you so much oskar_calvo!!!! Your solution works perfectly.
I cannot believe I didn't think of it myself heheh

drupalreggie’s picture

I have a menu item that uses tokens but I also need this to be controlled by roles. Is there a way to achieve this?

Regards

develcuy’s picture

Version: 6.x-1.0-alpha1 » 7.x-1.x-dev

D6 is discontinued.

mototribe’s picture

thanks a bunch! Worked for me too

drclaw’s picture

Hello,

I noticed this issue too, specifically with the menu_item_visibility module. Setting the module weight (or better yet just using hook_module_implements_alter() to reorder the implementations of translated_menu_link_alter) does indeed fix the problem, but is it not worth discussing why menu_token is resetting the menu item's access? As far as I can tell the reason this is an issue is from this bit of code in menu_token.module on line 160 in menu_token_translated_menu_link_alter()

// Load menu item and check access.
if ($menu_item = menu_get_item($url)) {
  $item['access'] = $menu_item['access'];
  return;
}

Why do we need this? The menu item should already have it's access array key set. There shouldn't be any reason to override it.. or should there?... Maybe I'm missing something there?

funana’s picture

kingfisher64’s picture

Can someone who is managing the mod please reply to what drclaw wrote in #10?

He has offered potential solutions to these issues.

Many thanks

Horroshow’s picture

Anyone?

R-H’s picture

Solution #4
My solution is to enable the util module, and give this:
menu per role : weight 5
token menu : weight 0

Works for me

develcuy’s picture

Issue summary: View changes

UPDATE! The default weight of Menu Token is now 10, so you need to set Menu per role weight a bit higher, say 15.

Please test latest dev build and report your feedback!

develcuy’s picture

Status: Active » Needs work
develcuy’s picture

Status: Needs work » Closed (works as designed)