New Plugin Adds Conditional Profile Fields to BuddyPress

photo credit: Dunechaser - cc
photo credit: Dunechasercc

When you create profile fields in BuddyPress, they apply to every user in the same way. Each user responds to the same set of questions, but this could stand to be a little more flexible to account for differences in users. What if you could conditionally show profile fields, based on a user’s answers to certain questions?

Prolific BuddyPress plugin developer Brajesh Singh created a plugin to do exactly this. Conditional Profile Fields for BuddyPress gives site administrators the ability to set conditions for hiding/showing profile fields based on a user’s responses to other profile fields. For example, let’s say you create a field to ask if the user is a morning or night person.

profile-field

You can then set up a second question, such as “Do you eat breakfast?” With the help of this plugin, you can make the question contingent on the first question where you asked if the person is a morning or night person. Perhaps you are curious if a user who identifies as a “night person” also eats breakfast. While editing the breakfast question, scroll to the bottom and you will find a new box for setting a Visibility Condition.

From the dropdown, select the question you want as the condition, show/hide, and the value that field is contingent upon. The plugin also includes support for muti-option fields.

conditions

Once you have your condition set, you can navigate to the frontend to see that the conditional fields are shown or hidden based on your selection. Here’s a quick demo:

conditional-profile-fields-demo

If you mark the first profile field as “Required” when creating it, then BuddyPress will also show the field on the registration form and conditional fields will also apply. The plugin currently supports the following features:

  • Compatible with 99% of WordPress themes
  • 2 visibility options to either show the field or hide the field based on the condition
  • A field dropdown box to allow you to select the field that governs the display of this field
  • 6 operators to match the values (6 operators for the number/text/textarea field and 2 operators for matching the multi-select box/check box/radio)
  • It supports the multi-type field as well as other fields (and should support custom profile fields automatically)
  • Currently the date field is not supported for creating conditions

The Conditional Profile Fields plugin is an excellent addition to any BuddyPress site that brings together different types of users. For example, educational sites might include students, teachers, tutors, etc. Instead of using a complicated plugin to set up different user types, you can add a conditional profile field to ask the user to select from student, teacher, etc. From there you can create different profile field groups containing questions conditional upon the user’s previous selection.

Conditional profile fields could also be useful for many other types of social networks, including:

  • Dating sites
  • Professional organizations
  • Sports teams
  • Multilingual communities
  • Job or freelancer networks
  • Hobby or interest-based networks

I tested the plugin with BuddyPress 2.1 beta 1 and found that it works exactly as advertised. Conditional profile fields are an excellent way to extend a niche social network to display profile fields specifically tailored to different user types. Download Conditional Profile Fields for BuddyPress for free from BuddyDev.com.

Would you like to write for WP Tavern? We are always accepting guest posts from the community and are looking for new contributors. Get in touch with us and let's discuss your ideas.

7 Comments


  1. Hi Sarah,
    Thank you for covering the plugin. And your gif and explanations are much better than my release notes :)

    Report


  2. Worked perfect, then suddenly it stopped working, after a week or so. I noticed that it does not save the values entered anymore. No new plugins, no theme changes. So – I am puzzeled ( and a bit disappointed too)

    Report


    1. Hi Tycho,
      Can you please point to your site or check if there is any javascript error? If the showing/hiding is not working It is most probably due to the js error. If the showing/hiding works but values are not saved in that case I am not sure what could be the reason.

      Report


      1. Hi Brajesh Singh,

        Thank you for your fast reaction. It shows a professional care, which I appreciate very much.
        When it comes to my site and your plugin, I found out that the error is a user error, being not a native English speaker I misunderstood some of the settings. Now that I am a little wiser ( and applied the correct settings…) everything works like it should.
        So thank you again for your fast reply, I am sorry that I did not look any better before posting the message above and I recommend Conditional Profile Fields for BuddyPress to everybody who needs this kind of plugin.

        Report


  3. This plugin is a lifesaver. Thank You! Any idea on how to make it compatible with Buddypress Profile Search?

    Report


  4. This plugin rules! Having something similar for the Buddypress Profile Search would be great.

    Report


  5. Have an issue with “Number of kids” field that I am using. If user selects 1 child then it is no problem as it will show 1 “First Name” field – plugin works fine. Problem is if say the user selects 3 children. This plugin only allows 1 condition, so how do you show 3 “First Name” fields? Also even with 1 condition it only allows = or not equal sign, there is no > 2. I hope you can understand what I am saying…

    Report

Comments are closed.