Conditionally Hide BuddyPress Profile Field Groups Based on User Role

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.

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:

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.