Skip to:
Content
Pages
Categories
Search
Top
Bottom

Displaying XProfile Field Groups Dependen on User Role

  • @lebearuk

    Participant

    I’m new to BP so I appologise if I’ve missed something in the documentation before posting.

    I have created 3 additional roles in wordpress.

    Roles
    user 1 | user 2 | user 2 (currently all set to spectator role)

    What I am trying to acheive is a way to customise what XProfile field groups they will be assigned. Also, whether they have access to group creation.

    Can someone point me in the right direction of what files I should be looking at in BP. I’m guessing there’s a loops that I could modify,

    if userrole==’user1′
    output field groups
    if userrole==’user2′
    output field groups
    if userrole==’user3′
    output field groups

    Something like that anhow lol, or is there a preffered method I haven’t discovered yet.

    I’m trying to simulate different member types / capeabilities.

    Thanks

Viewing 2 replies - 1 through 2 (of 2 total)
  • @imath

    Moderator

    Hi,

    Make sure to leave the base group profile fields available for all users

    Then explore in this direction :

    /* Profile display */
    function excluding_group_id_depending_on_user_role( $args = array() ) {
    	if ( user_can( bp_dispayed_user_id(), 'capability_to_check' ) {
    		$args['exclude_groups'] = "2,3,4"; //Comma-separated list of profile field group IDs to exclude
    	}
    	return $args;
    }
    add_filter( 'has_profile', 'excluding_group_id_depending_on_user_role', 10, 1 );

    /* profile editing */
    It will be a bit more complex as you’ll need to filter ‘xprofile_filter_profile_group_tabs’ and use a pattern to exclude the tabs you don’t want the role to edit.

    Finally to restrict group creation, i’ve shared a code on the BuddyPress fr community :
    http://bp-fr.net/agora/sujet/restreindre-la-creation-des-groupes-a-des-roles-wp/

    @lebearuk

    Participant

    Hi imath,

    Thanks for this, I’ll let you know how I get on. I’ve been trying to implement this for some time… I’ve spent way too much time trying to do it.

    I’m considering hiring a developer for a couple of hours to integrate this functionality. Are you available or can you recommend someone?

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Displaying XProfile Field Groups Dependen on User Role’ is closed to new replies.
Skip to toolbar