How to Show or Hide Divi Builder elements using Infusionsoft Tags

Memberium Admin — 

In this post, we’ll show you how to conditionally display or hide Divi Builder modules based on a member’s existing Infusionsoft tags, current membership level or based on the user’s current login status (logged in or logged out).

First of all, let’s open the page in the back-end and see the Divi modules on the page. Once we have that opened, we need to click on the “hamburger button” next to the Divi module/element for which we want to change content protection for.

Once there, we should see a pop-up window like on the image below. In there, we should navigate to “Advanced” tab and scroll down just a little bit, until we see “Memberium” headline. Under “Memberium” headline, we will see content protection options which we can select in order to protect that specific Divi module.

Please note that you can have different content protection for each of your Divi modules, regardless of the page content protection and regardless of content protection of other Divi modules.

How to display modules using “PHP Boolean Expression:” field?

Once you are in the “Advanced” tab for specific Divi module, if you scroll down at the very bottom, you’ll notice “PHP Boolean Expression” field. In this field, you can specify WordPress or Memberium functions, such as is_user_logged_in(), memb_hasMembership(), memb_hasAnyTags(), etc.

In this section, we’ll talk about how to use these functions in order to conditionaly show/hide specific Divi module…

How to display a module to members with a specific membership level: memb_hasMembership

memb_hasMembership() allows you to show or hide a module by membership level.

To use this, we’ll need to find the exact name of the membership level that you want to display the module for.

In the admin area of your WordPress site, navigate to ‘Memberium > Memberships’ and find the name of the membership level you’re looking for and copy it.

Let’s say we want to display a module only to members with the ‘Free Membership’ membership level.

You’d use the following example function in the “PHP Boolean Expression:” field (be sure to exactly match the name of your membership level, names are not case sensitive):

memb_hasMembership("Free Membership")

To display a module to members who are not ‘Free Membership’ members, you’d use the following function in the “PHP Boolean Expression:” field with an exclamation point(!) in front of the function to reverse the visibility logic:

!memb_hasMembership("Free Membership")

How to display a module to members who have ANY of the following Infusionsoft tags: memb_hasAnyTags

The function memb_hasAnyTags allows you to display a module by Infusionsoft tag.

To find the ID for a tag that’s not a membership level (to display a module based on membership level, you should only use memb_hasMembership and not memb_hasAnyTags), you can find the tag id in Infusionsoft by navigating to CRM > Settings > Tags and the Tag ID’s are listed in the ID column as pictured below.

“Tag ID” would be the number from “Id” column

To display a module to a member who has a specific Infusionsoft tag, for example, let’s say the tag id of ‘130’, all you need to do is paste the following into the”PHP Boolean Expression:” field (be sure to include your own tag ID in place of ‘130’):

memb_hasAnyTags("130")

To hide the module from anyone who has this tag, and display it to anyone without it, you just need to add an exclamation mark in front of the function:

!memb_hasAnyTags("130")

If you want to hide or show a module from anyone who has ANY of the following Infusionsoft tags you just add a comma between the tag id’s.

This will display a module to members with any of the following Infusionsoft tags:

memb_hasAnyTags("130,128")

This will hide a module from any member with any of the following Infusionsoft tags:

!memb_hasAnyTags("130,128")

How to display a module to members who have ALL of the following Infusionsoft tags: memb_hasAllTags

In certain situations, you’ll want to display or hide a module from members who have multiple Infusionsoft tags.

To display a module for a member who has ALL of the Infusionsoft tags specified you would use the following function in the”PHP Boolean Expression:” field (be sure to add your own tag id’s in place of the example):

memb_hasAllTags("130,128")

To hide a module from a member who has ALL of the following Infusionsoft tags you would use the following in the “PHP Boolean Expression:” field:

!memb_hasAllTags("130,128")

How to display a module based on a user being logged in or out: is_user_logged_in

To display a module only to members who are logged in, you’d use the following example in the “PHP Boolean Expression:” field:

is_user_logged_in()

This module will be hidden completely from any logged in user and will only display to visitors who are logged out:

!is_user_logged_in()
  • Was this Helpful?
  • YesNo