Conditionally Hide BuddyPress Profile Field Groups Based on User Role

buddypress-conditional-field-groups-featured

For many BuddyPress-powered social networks, profile field groups do not work as a one-size-fits-all container. This is especially true for sites with a more complex and varied user base.

By default, BuddyPress displays all profile field groups to all users, whether they are applicable or not. The new BuddyPress Conditional Field Groups plugin is one way to address this problem and provide more flexibility for administrators in field group creation.

The plugin, created by WordPress developer Tanner Moushey, allows administrators to hide a field group based on user roles. This makes it possible to collect and display different sets of information based on selections assigned in the plugin’s settings panel.

buddypress-conditional-field-groups-settings

As all field groups default to visible to all users, the field groups that are checked in the settings will not be shown for the corresponding user role on the front end. For example, for users with author or contributor roles, the site can feature additional profile fields related to their specific roles in the community while hiding that field group for all other roles. Here’s a quick demo:

bp-conditional-profile-field-groups-demo

Combine it with the Conditional Profile Fields plugin and you have a great deal of flexibility.

Of course, this plugin only applies on sites where members have been neatly divided into user roles by an administrator. Since these roles are generally assigned based on publishing capabilities, this plugin is likely useful for sites that are running an active blog.

If Moushey were to further extend BuddyPress Conditional Field Groups plugin, it would be useful to be able to hide field groups based on member type, as defined by any plugin utilizing the new Member Type API added in BuddyPress 2.2. This would greatly expand the usefulness of the plugin for more communities.

The plugin in its current form is a valuable tool for BuddyPress-powered communities that rely heavily on WordPress user roles to define capabilities for a diverse user base. BuddyPress Conditional Field Groups is available for free on WordPress.org.

14 Comments


  1. Thanks Sarah! While I don’t have an official roadmap for the plugin, I would like to add Member Type support sooner than later.

    If Member Type support would be helpful for anyone else, let me know. The greater the need, the sooner it will happen. :)

    Report


  2. I would also like to see member type support :-) and thank you for the great plugin!

    Report


  3. +1 for member type support!

    Report


  4. Nice and useful plugin. The only negative thing is the UI. Why does it add a new submenu page instead of extend the existing BuddyPress profile groups editor?

    Report


    1. Good question Pascal (and sorry for the late response). This was a decision made for the client who had many user roles and profile field groups, so this was a better UI for that situation.

      Report


  5. This is a fantastic add-on for BuddyPress, the more when it would support Member Type.

    So please Tanner, if you could make this happen sooner than later, then I would be grateful.

    For now, I must create new WP User Roles, but how could I add a selection menu of this new User Roles at BuddyPress registration?

    I’m very much in need of this solution, so every feedback is very much appreciated.

    Report


    1. One way you could go about this would be to use a plugin like Gravity Forms and use the User Registration add on. There you could use a registration form to handle registering multiple different user roles.

      Honestly, though, user roles is really more of a band aid. Using Member Types would be a better solution and conditional Profile Fields by Member Type will probably be a part of BuddyPress 2.4 (see the trac ticket mentioned by Boone above).

      Report


  6. I’ve been looking for something like for ages. Thanks for bringing it to my attention.

    Report


  7. Is there any way not to just hide the fields, but to exclude them from the search pool of the profile search?
    I’d like to use some fields for saving some sensitive data. And just searching for the data reveals the user whom it belongs. I’d like to disable it, so its just visible (or even hidden for certain accounts), but not searchable.

    Report


    1. Hey Maksym! Can you just set the profile field visibility to “Only Me”?

      Report


  8. Hrm, i’m not seeing any groups except the Base group, in the user’s front-end profile, with or without the above plugin. Is this a problem with my theme? thx!

    Report

Comments are closed.