User Fields is a robust feature in Paid Memberships Pro to create custom profile fields for your membership site. There are loads of field types and loads of places you can collect user profile information about your members.

This post highlights the ability to set one field as dependent on another field’s value. We call this a “conditional” field. Keep reading to see the example and learn how to add conditional field logic your membership checkout page or on the frontend user profile edit page.

Banner for Advanced Code Recipe Tutorial for Paid Memberships Pro

Understanding Conditional User Field Logic

The easy way to understand conditional fields is to use an example, in this case a demo where the site asks what type of pet you have: Cat or Dog.

The conditional field is displayed based on the user’s selection:

  • The logic shows a text input field for “Cat’s Name” if the user selected “I have a [Cat]”.
  • The logic shows a text input field for “Dog’s Name” if the user selected “I have a [Dog]”.

At this time, conditional field logic and the “depends” field attribute must be added via custom user field code.

Before selecting the field - no additional input is displayed.
Before selecting the field – no additional input is displayed.
After selection is made, the dependent field input shows.
After selection is made, the dependent field input shows.

While this is a fairly simple example, it shows how you can build a robust form with conditional entries to capture additional information at checkout or on the member profile.

These fields can be used in your Member Directory and Profile pages, added to your third party email platform for enhanced targeting, or even duplicated as a member’s BuddyPress xProfile fields.

Conditional Code Recipe

This code recipe demonstrates another way to use conditional fields. See our full guide on how to ask “How did you hear about us?” at membership checkout.

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.

You’ll need to update the recipe for your own conditional fields, but this provides the basic overview of how to set a conditional field. See more documentation on conditional fields here.

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.

Featured Image for Membership Site Development Course: The Basics
Was this article helpful?
YesNo