If you’re using the Multiple Registration Forms module to create distinct registration forms for the different user types you are registering, you probably want to also create Multiple Edit Profile forms. When using BuddyPress, you can only select 1 Edit Profile to show instead of their form.
With the custom code from below, it is possible to show the correct edit profile form, based on the user role, on the BuddyPress Edit Profile page when a user tries to edit his profile:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 | function wppbc_bp_different_edit_forms_based_on_role($form_name) { if (function_exists( 'bp_current_user_id' )) { $user = new WP_User( bp_current_user_id() ); } else return $form_name; if (in_array('editor', $user->roles)) return 'editor-form-name'; else if (in_array('customer', $user->roles)) return 'customer-form-name'; else return $form_name; } add_filter('wppb_bdp_edit_profile_form_name', 'wppbc_bp_different_edit_forms_based_on_role', 20, 1); |
The code needs to be customized based on your setup.
In this example, I am showing users that have the editor user role the form with the name editor-form-name and users that have the customer user role the customer-form-name.
If the user doesn’t have any of these roles, he will see the default form that was selected by going to Profile Builder -> BuddyPress in the Edit Profile form setting.
After you added this, when viewing the BuddyPress Edit Profile page, users will see the right form based on their user role.
Instructions for using this code can be found at the top of this page. If you don’t want to follow the method there, you can just take the code and paste it in the functions.php file from your child theme.
If you have questions or need help with this, please contact support.
Combine the power of Profile Builder with Paid Member Subscriptions to set up user registration, memberships, and recurring revenue.
Get 25% off with the bundle