The Nav Menus Add On for Paid Memberships Pro offers a sophisticated solution for membership sites aiming to deliver a tailored navigation experience to users based on their membership level. Out of the box, the logic assumes that each member has a single membership level. A user with several levels will still only be shown a single navigation menu.
This code recipe demonstrates how to use the pmpronm_prioritize_levels
filter hook to set the priority of which menu to display when the user has more than one membership level.
About the Nav Menus Add On
The Nav Menus Add On enhances navigation for membership sites by enabling dynamic swapping of navigation menus and allowing the creation of personalized menus tailored to each membership level.
For members, it means instant access to the content and features they value most, facilitated by a single click. For visitors, it’s a smooth guide towards understanding the benefits of membership, encouraging them to sign up. This approach not only enhances the overall site experience for users across the board but also supports sites with a freemium model in effectively upselling users by leveraging navigation as a strategic tool.
By addressing the unique needs and access rights of individual members, the Nav Menus Add On plays a pivotal role in creating a more engaging, responsive, and user-centric website environment.
About the Code Recipe
A notable challenge arises when users hold multiple memberships, as the Add On, by default, is designed to recognize a single membership level per user. To overcome this, you can prioritize which menu is shown based on the levels the user holds with the pmpronm_prioritize_levels
filter hook.
This recipe below allows for the prioritization of menus, ensuring that users with multiple memberships are presented with the most relevant navigation menu, thereby enhancing the utility and flexibility of the Nav Menus Add On.
The Code Recipe
Adjust the array on line 13 with your prioritized level IDs, placing the most important level IDs first. A user with multiple membership levels will see the menu assigned to their most important level as declared in this array.
Adding the Recipe to Your Website
You can add this recipe to your site by creating a custom plugin or using the Code Snippets plugin available for free in the WordPress repository. Read this companion article for step-by-step directions on either method.
Free Course: Membership Site Development—The Basics
Develop a deeper understanding of membership site development in this beginner-level course. Learn how to make your site work better, save yourself time and money, and improve your site's performance.