Skip to:
Content
Pages
Categories
Search
Top
Bottom

Anyway to sync the Xprofile name with the Buddpress Username

Viewing 1 replies (of 1 total)

  • petertucker
    Participant

    @petertucker

    Here is the solution for anyone who is going to see this post in the future.

    1. Install the username change plugin:
    https://buddydev.com/plugins/bp-username-changer/
    2. Add to the plugins code (bp-change-username.php) on line 163;

    
    xprofile_set_field_data(1, $user_id,  $new_user_name);
    

    3. In your theme function.php file add the follow code to hide XProfile editing:

    
    function bpfr_hide_profile_field_group( $retval ) {
            if ( bp_is_active( 'xprofile' ) ) :     
    
            // hide profile group/field to all except admin 
            if ( !is_super_admin() ) {
                    //exlude fields, separated by comma
                    $retval['exclude_fields'] = '1';  
                    //exlude groups, separated by comma
                    //$retval['exclude_groups'] = '1';
            } 
            return $retval;         
    
            endif;
    }
    add_filter( 'bp_after_has_profile_parse_args', 'bpfr_hide_profile_field_group' );
    

    I hope this helps anyone who finds it.

Viewing 1 replies (of 1 total)
  • You must be logged in to reply to this topic.
Skip to toolbar