This code recipe will allow you to add custom content to the map marker info windows shown when using the Membership Maps Add On. Use this filter to hide specific information to non-members or add new member information for specific membership levels, opening up a variety of use cases.
About the Code Recipes
By default, our Paid Memberships Pro Membership Maps Add On shows a map marker for each member. The default marker shows the following information, which can be customized using the Maps Add On shortcode attributes:
- Display Name (optionally linked to their individual profile page if using the Member Directory and Profiles Add On).
- User Avatar
- Email Address
- Membership Level
- Membership Start Date
- Additional User Fields as defined in the Maps shortcode’s
fields
attribute.
In some cases, you might want to change how this data is displayed, or perhaps you want to add something unique for each membership level. Use the recipes below as a starting point for ways to customize your map markers.
Code Recipe #1: Add Information to All Map Markers
This code recipe shows you how to append additional information to the map marker. This information will be shown for all people that can view the map.
Code Recipe #2: Add Information If the Viewing User Has Specific Membership Levels
This code recipe shows you how to add additional information to the map marker only if the person viewing the map has one of a specific subset of membership levels. This is an important security decision if you are showing personally identifying information or premium details that only other members should be able to view.
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.