Conditional Menus
Overview
Ultimate Member's conditional menus feature provides the flexibility to display different items based on the viewer's status, whether logged in or out and specific member roles. This guide outlines the process of applying conditions to a menu for a personalized user experience.
Note: If you want to set navigation menu restrictions in the Block theme then go to this article: https://docs.ultimatemember.com/article/1624-restrict-gutenberg-blocks
How to apply conditions to a menu
- Navigate to the menus page in the WordPress admin by going to
wp-admin > Appearance > Menus
- Add your menu items to the menu structure.
- Once you have added your menu items to the page click on the small arrow to expand a menu item.
- Look for the "Ultimate Member Menu Settings" section to add conditions.
Conditions Options: Everyone, Logged Out Users or Logged In Users
You have three options to determine who can see a menu item:
- Everyone – Everyone is the default state for menu items which means that everyone who visits your site will see this menu item.
- Logged out users – If you select this option it means that this menu item will only be visible to visitors (e.g. logged out users). When someone logs into your site they will no longer see this menu item.
- Logged in users – Choosing this option ensures that the menu item is visible exclusively to logged-in users, remaining hidden from logged-out visitors and non-members. Upon selecting logged-in users, checkboxes will appear, displaying all user roles on your site. If you wish to display the menu link to a specific role(s), simply select the roles authorized to access the link.
- Verified Options # - This feature becomes accessible upon activating the Verified Users extension. It enables you to configure the menu to be exclusively visible to verified users.
Notice: Menu items that are related to the individual post can be removed from the menu items query based on Restricted Content settings. Please pay attention that the individual Restrict Content settings have the highest priority in this case.
Show display name on a menu item
Using our short tags allows you to show a user’s name in the menu instead of the name of the page. Instead of showing the user or my profile in your site’s menu, you can instead make the user page show the logged-in user’s name (e.g John Doe). You can add the following short tags to the menu link: {first_name} {last_name} {username} {nickname}. To use this feature you simply add the short tags to the menu item’s navigation label like so:
Show the user profile photo in the menu
You can also show the user's profile photo in the menu using the short tag {user_avatar_small}. If you add this tag into the navigation label field the profile photo for the user will show.
Note: You need to know how to use CSS as due to your theme's styling you will need to use CSS to make this look ok on your site. We can do nothing with this feature to make it look fine out of the box as every theme styles its headers differently.
Log in, register & logout pages
Many membership/community-based sites will commonly show register and login links in their site's menu for visitors and show a logout link in the menu once the user has logged in. The links should have the following setup:
- Log in & register links – For both of these menu items you should select the logged-out user option
- Logout link – For this menu item you should select the logged-in user option