Conditional Menus

Overview

Ultimate Member provides a conditional menus feature that allows you to display different items in your site’s menus depending on who is viewing the site. For example, you can show different menu items to logged-in and logged-out users, as well as show menu items only to certain member roles.

How to apply conditions to a menu

To create a menu with conditional logic go to the menus page in the WordPress admin then 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.

Once you've expanded a menu item you will see the Ultimate Member section called: “UltimateMember Menu Settings”. This is where we will add a condition to this menu item.

Everyone, logged out users or logged in users

You have three options to select from when deciding who can see a menu item: everyone logged out users and logged in users.

  • Everyone – Everyone is the default state for menu items and 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 – If you select this option it means that this menu item will only be visible to logged-in users. Visitors and non-members will not see this link. Once logged-in users are selected you will see some checkboxes appear which show all the Ultimate Member roles on your site. If you want to show a menu link to a certain role(s) then you can select the roles that will be able to see the link.

Notice: Menu item that is related to the individual post can be removed from 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 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. There is nothing we can do 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