Skip to:
Content
Pages
Categories
Search
Top
Bottom

[Resolved] Customise register page


  • jessicana
    Participant

    @jessicana

    I would like to see more improvements regarding the registration page where users can show/hide their real names. Is this possible?

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

  • jessicana
    Participant

    @jessicana

    I would like to see more improvements regarding the registration page where users can show/hide their real names. Is this possible out of the box without plugins?


    danbp
    Moderator

    @danbp

    @jessicana,

    The field NAME in the field group BASE is required. This group is used for the registration page to work. As you already know, it’s also this group who allows you to show custom fields on the registration page.
    The NAME field in BuddyPress is intended to receive first and last name and replace the two original fields (first name, last name) coming with WordPress.

    That said, you can hide this field to users, but you can’t give them the choice to show/hide it.

    The above snippet will hide the field NAME to all visitors/members, but not to site admin and the concerned profile.

    function bpfr_make_name_members_only( $retval ) {	
    	//hold all of our info
    	global $bp;
    	
    	// is xprofile component active ?	
    	if ( bp_is_active( 'xprofile' ) )
    	
        // The user ID of the currently logged in user
        $current_user_id = (int) trim($bp->loggedin_user->id);
    	
        // The author that we are currently viewing
        $author_id  = (int) trim($bp->displayed_user->id);
    	
    	// user can see only his name && admin can see everyone 
    	if ($current_user_id !== $author_id && !current_user_can('delete_others_pages') ) {
    		$retval['exclude_fields'] = '1';	
    	}
    	return $retval;	
    }
    add_filter( 'bp_after_has_profile_parse_args', 'bpfr_make_name_members_only' );

    Add this to your child-theme functions.php or to bp-custom.php

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘[Resolved] Customise register page’ is closed to new replies.
Skip to toolbar