Skip to:
Content
Pages
Categories
Search
Top
Bottom

Restricting User Group Profiles


  • bvirkus
    Participant

    @bvirkus

    Is it possible to restrict the user profile group to a certain level member of our site? Hence, a certain member type will have an expanded profile, where the other level member will just have basic info?

Viewing 4 replies - 1 through 4 (of 4 total)

  • Henry
    Member

    @henrywright-1

    The way to do this would be to wrap info fields in conditional statements like this

    if member type is X then
        // display info field

    bvirkus
    Participant

    @bvirkus

    Where/how do I do that?


    Henry
    Member

    @henrywright-1

    Well first you’d need to write some code

    
    // find the user's role
    $user = new WP_User( bp_displayed_user_id() );
    $role = $user->roles[0];
    
    // find the profile field value you want
    $location = bp_get_profile_field_data( 'field=Location' );
    
    // perform a conditional check making sure the user has a specific role and has completed the profile field before displaying the value
    
    if ( ( $role == 'Blah' ) && ( $location ) )
        echo $location;
    

    Notes:

    • replace Blah with the role you want
    • replace Location with the name of the profile field you want
    • I have assumed all of your users have just one role assigned

    Henry
    Member

    @henrywright-1

    Ah, you want profile group not profile field. Sorry. But it shows you the general way PHP can be used

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Restricting User Group Profiles’ is closed to new replies.
Skip to toolbar