Skip to:
Content
Pages
Categories
Search
Top
Bottom

Make Profile Name field visible by admin only?


  • GSJ
    Participant

    @gsj

    Hi there, I noted Buddypress 1.7 allows admin only visibility for everything except the Profile Name Field… ?
    Any reason for this, as I want to run a website with users being known by their usernames only, with the option to show your real name on your public profile determined by the user.
    Alternatively, is there a way to enforce that only usernames are to be showed on public profiles?
    That’s how it seems to work when I login to the Buddypress support forums, so wondering why this functionality isn’t included as part of the plugin?
    I’m hoping to find a solution to this so my site can go live!
    Thanks.

Viewing 1 replies (of 1 total)

  • meg@info
    Participant

    @megainfo

    Hi @gsj,

    Add this code to functions.php file of the current theme.

    `
    add_filter(‘bp_xprofile_get_hidden_fields_for_user’,’bp_define_hidden_fields’, 10 ,3 );
    function bp_define_hidden_fields( $hidden_fields, $displayed_user_id, $current_user_id ) {
    //if not admin or if not the the profile of the current user
    if ( !is_super_admin( $current_user_id) && ($displayed_user_id != $current_user_id) ) {
    //add name field ( id = 1 ) to the hidden fields
    $hidden_fields[] = 1;
    }
    return $hidden_fields;
    }
    `

Viewing 1 replies (of 1 total)
  • The topic ‘Make Profile Name field visible by admin only?’ is closed to new replies.
Skip to toolbar