Assign XProfile Field Groups to Members

I'm trying to assign xprofile field groups to members based on their membership type / capeabilities.

I have a field in the registration form where they select a profile type. I'd like to use this other than using a member role.

I'm finding it difficult to work out how to pass the argument in the edit loops for example, or is there a better method??

  • Ryan
    • WPMU DEV Initiate

    Hi Patrick,

    No I'm not using the BPUATL plugin, I had looked at it but it doesn't look like it's going to get any support etc so I keep away from it just in case.

    I use xprofile fields for creating all the profile groups, but whilst signing up I have created a dropdown field to select a profile type. At the moment this is nothing more than an additional profile field.

    Based on their selection, I would like to use this data to control what xprofile field group access there have.

    I'm will be using Members further down the line, I'd though it would be a good idea to integrate it now.

    So if user selected Profile Type 1, they have access to Field Groups 1,3,5. Profile Type 2 has access to Field Groups 1,2,3 and so on.

    I've been trying to figure out manipulating the loops in BP, edit.php / xprofile-fields-template.php etc. I'm looking at the classes but struggling to pass the right arguments...

    For example

    I'm pretty sure this is the kind of thing i need to be doing but how do you pass the arguments?

    I hope this makes sense, I'm not the only one trying to figure this out. My knowledge of OOP PHP is limited at the moment.

  • Ryan
    • WPMU DEV Initiate

    so for the view my profile, edit my profile page I'd like to do the following.

    if profile-type = 1
        load field groups 1,3,4
    if profile-type = 2
        load field groups 1,2,3
    if profile-type = 3
        load field groups 1,3,5
    Specifically the sub tabs from edit
  • Ryan
    • WPMU DEV Initiate

    I've kind of got this working using a plugin called UserPro, but I would like to keep the website focused on the BP functionality. And the (lack of) documentation is a headache.

    Another method that works is using the buddypress field group ACL plugin, but creating additional roles in wordpress, though I'd struggled to assign a role at login.

    They all profile types only need the role of subscriber for user role too.

    Again this lacks support.

    A plugin by WPMU to do this would be massive I'm sure.

  • Hoang Ngo
    • Code Slayer

    Hey there Ryan,

    I hope you are well today and I'm very sorry about the delay.

    This feature is complex and will require extremely coding.

    We have a job board, which you can hire quality developer here.

    If you hire one, here are some points will help the developer.

    When visitor clicked on a subscription button, the subscription id can be archive by $_GET['subscription'].

    File plugins/buddypress/bp-themes/bp-default/registration/register.php is use for process the register form, the line 71 & 72 and the function bp_profile_groups(), bp_profile_fields() is a good place to start.

    Best Regards

  • Ryan
    • WPMU DEV Initiate

    Thanks for all the replies, I'd love to hire a developer but I don't have the resources at the moment.

    I've found a solution that works for my requirements at the moment, I'll improve on this once I develop my knowledge of BP/WP/PHP

    I've installed this Plugin to assign Buddpress field groups to user based on their WP role type

    BuddyPress xProfiles ACL

    I'd created additional roles using User Role Editor.

    Then I'd added the following code to apply the role based on a selection during the registration process.

    	// user selects profile type from dropdown menu during registration
    	// after registration the field data is used to apply a role
    	$user_role = xprofile_get_field_data('Profile Type', $user_id);
    	switch($user_role) {
            case "Fighter":
                $new_role = 'fighter';
            case "Academy":
                $new_role = 'academy';
    	case "Spectator":
                $new_role = 'spectator';
            'ID' => $user_id,
            'role' => $new_role

    I'm keen to develop this basic implementation further to exlude the use of the plugin, I'll post it on here once ready. Maybe using capeabilities would be more suited as all profile types are based on the subscriber configuration.

  • PC
    • WPMU DEV Initiate

    Hey there Ryan,

    Thanks for posting back.

    That sounds like a great idea to me. We will be around and keen to hear from you. During the development, if you need pointers or directions, please feel free to ask and our team will be here to help :slight_smile:

    Cheers, PC

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.