1

I am attempting to manually generate a menu which combines several menus with menu_tree_all_data. The problem I am having is that if the user is authenticated the first time the menu is built, the menu will be cached and anonymous users will see access denied when clicking some menu items.

Ideally I only want to include menu items which are accessible to the anonymous user in the generated menu. I am thinking I need to do a check against the access_arguments to skip the menu items I don't want to include but I'm not sure what that would look like. Here is the access arguments from a print_r of a menu item that should NOT be included in the generated menu:

[access_callback] => node_access [access_arguments] => a:2:{i:0;s:4:"view";i:1;i:1;}

and here is one that should be included in the menu:

[access_callback] => user_access [access_arguments] => a:1:{i:0;s:14:"access content";}

Am I on the right track with this or going about it all wrong? Any help would be much appreciated.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.