PMPro User Fields

The Paid Memberships Pro WordPress plugin introduces a feature to create & set custom User Fields for members. It’s a great addition to their plugin, which has led us to make a great visibility condition called “PMPro User Fields” within our plugin Conditional Blocks Pro.

How change block content based on User Fields

The visibility condition can be added to any WordPress block content, and will automatically detect the value of the fields. Let’s firstly create the user fields within PMPro.

1. Setting up User Fields

In this example we are creating a new field called “how did you hear about us?“. User Fields are created within the PMPro settings. Refer to the screenshot below.

Our new field will be shown in the checkout flow, where new customers fill out the field value.

Developer note: The custom user fields are saved into the user meta within WordPress.

Screenshot of adding custom user fields using the Paid Memberships Pro plugin for WordPress

How are User Fields stored?

The custom User Fields setup in PMPro are actually stored in the WordPress User Meta data. You can optionally choose if they should be visible in the user settings or not. We do recommend you manually set the field values here for quickly testing if the visiblity conditions appear as expected.

2. Creating unique content

Choose a page or a post where you want to control the visibility of some content. You could create any type of blocks, even Group blocks together for easier management.

3. Apply visibility conditions based on User Field value

Now we can move onto applying the visibility condition to the content you’ve just created. Click on the block (or Group block), then navigate the sidebar and click on the Conditional Blocks menu, you now click on the “Edit visibility” button.

In the Condition Builder, find and select the PMPro User Fields condition. Setting up the PMPro User Fields is easy because all registered fields and groups are automatically displayed and selectable.

Click on the newly created “How did you hear about us?” field, then you’ll be able to select the “operator” which will be used to check for an expected value. For the example we’ll use the operator called “Contains“, then set the expected value to “Google“.

Congratulations, you’ve now set up your first dynamic content which will only show to users who have mentioned “Google” in the user field “How did you hear about us?”.

We recommend that you use the User Switching plugin to test different users who have different field values. You can also edit the field values directly on the WordPress User settings to ensure the conditions are trigger correctly between hidden and showing.

Available Operators

Here’s the list of all value operators you use to check the expected value of user fields.

  • Has any value (true)
  • Has no value (false)
  • Not equal to
  • Contains
  • Does not contain
  • Greater than
  • Less than
  • Greater than or equal to
  • Less than or equal to

Was this page helpful?