Skip to:
Content
Pages
Categories
Search
Top
Bottom

Changing Name's default visibility


  • ChiefAlchemist
    Participant

    @chiefalchemist

    Greetings

    I would image this answer is somewhere else but I could seem to find it.

    We’d like to change the Name’s default visibility from ‘public’ to something else (custom).

    Thanks (again).

    mfs

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

  • danbp
    Participant

    @danbp

    @chiefalchemist

    not the exact answer, but a way how to do it.
    This snippet will make the NAME field hidden to all except for admins

    function bp_define_hidden_fields( $hidden_fields, $displayed_user_id, $current_user_id ) {
    	
    	//if not admin or if not 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;
    	}
    add_filter('bp_xprofile_get_hidden_fields_for_user','bp_define_hidden_fields', 10 ,3 );

    Reference:
    bp-xprofile/bp-xprofile-classes.php


    ChiefAlchemist
    Participant

    @chiefalchemist

    Thanks @danbp

    Might help. But isn’t there a way to figure out where that is set and change it? I’m mean it’s got to be in the DB as an option / meta or something, eh?

    Basically, I’ve come up with a new list of visibility values and public is not one of them. I can code in an exception for name => public but that feels so hack-y, eh?


    danbp
    Participant

    @danbp

    see bp-xprofile/bp-xprofile-classes.php:393


    ChiefAlchemist
    Participant

    @chiefalchemist

    cheers @danbp

    This is my first week w/ BP. I’m starting to realize the value of text search against the whole BP code base. That said, it’s a very sophisticated product so until I get a bit more comfortable with things I would rather ask than assume.

    Thanks


    danbp
    Participant

    @danbp

    You’re welcome !

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Changing Name's default visibility’ is closed to new replies.
Skip to toolbar