This plugin allows you to display menu items based on if a user is logged in, logged out or based on the role you have given the user.
This plugin allows you to display menu items based on if a user is logged in, logged out or based on the role you have given the user.
This plugin allows fine-grained permissions to be added to each individual menu item to display or not display the item based on the
users logged in/logged out status or the role assigned to the user. This solves the problem of having to modify theme functions.php files to add in menu restrictions. The changes in functions.php is often overwritten by a theme update. This plugin removes that worry, as you can update the theme, independent of the plugin.
This plugin uses a modified version of the Nav Menu Walker class. This means any other plugins that utilize their own custom Nav Menu Walker class, can and will conflict with this plugin. WordPress developers have support for proper custom hooks in this area of the Admin Menu slated for v4.8 release. Please see FAQ item “I cannot see the options for Privilege Menu under menu items in the Admin Panel?” for more information.
plugin
folder to the /wp-content/plugins/
directoryHow to add an menu item as only viewable to logged IN users.
How to add an menu item as only viewable to logged OUT users.
This is the menu a logged IN user would see. These users don't see "Login" due to the fact that it is denied to logged IN users in the Admin Panel Nav Menus section.
This is the menu a logged OUT user would see. These users don't see "Logout", "My Account" or "Control Panel" due to the fact that they are denied to logged OUT users in the Admin Panel Nav Menus section.
This is a view of a menu item you could select only to be viewable for administrators.
Yes you can. Included now in this plugin is a folder call “lang”. Within this folder is a file called “privilege-menu.pot”. This file can be used to create the localized translations for your own language using poedit.
If you contact me after you have done this through my website at: https://www.fuzzguard.com.au/contact/ I can include this translation file in the next plugin release. You will be credited for your work of course.
This usually occurs due to a plugin conflict. The Admin Menu Walker can only have one custom walker so any other plugin that uses a custom Admin Menu Walker will cause conflicts with Privilege Menu plugin.
WordPress does not yet have sufficient hooks in this area of the admin panel. Due to this plugins are forced to load a modified custom Admin Menu Walker. The custom Admin Menu Walker is limited to one so only one Admin Panel menu modification plugin can be active at one time.
Although this feature has been requested since 3.6 it still hasn’t been added to the WordPress Core.
There’s a possibility that support for “Nav Menu UI” Hooks will be added in WordPress 4.8 as it has now been picked up by the developers and they are actively working on implementing this:
https://core.trac.wordpress.org/ticket/18584
There are two hooks that have been provided for this plugin. The first hook is: ‘priv_menu_roles’. It can be used to allow other plugins to add roles to be checked by ‘Privilege Menu’:
add_filter( ‘priv_menu_roles’, ‘roles_to_add’, 10, 1 );
function roles_to_add($roles /* WP_RoleNames Array */) { $roles['new_role'] = 'New Role'; return $roles; }
The second hook is: ‘priv_menu_visibility’. It can be used for other plugins to filter the result for the front-end display of the menu items generated by ‘Privilege Menu’:
add_filter( ‘priv_menu_visibility’, ‘filter_FE_display’, 10, 2);
function filter_FE_display($visibility /* Boolean */, $item /* WP_POST Object*/) { if ($item->ID == '470' || $item->title == 'Logout') { $visibility = true; } return $visibility; }