Answers for "REPLACE USERNAME BY NAME youzify"

0

REPLACE USERNAME BY NAME youzify

<?php
/**
 * Change user display name to username.
 */
function yzc_change_bp_display_name_to_username( $display_name, $user_id ) {
    // Get User Data.
    $user = get_userdata( $user_id );
    return $user->user_login ;
}

add_filter( 'bp_core_get_user_displayname', 'yzc_change_bp_display_name_to_username', 10, 2 );

/**
 * Change user full name to username.
 */
function yzc_change_bp_full_name_to_username( $display_name ) {
    $bp = buddypress();
    return isset( $bp->displayed_user->userdata->user_login ) ? $bp->displayed_user->userdata->user_login : '';
}

add_filter( 'bp_displayed_user_fullname', 'yzc_change_bp_full_name_to_username', 10 );

/**
 * Change user first name to username.
 */
function yzc_change_bp_first_name_to_username( $first_name ) {
    // Get User Data.
    $user = get_userdata( bp_loggedin_user_id() );
    return $user->user_login ;
}

add_filter( 'bp_get_user_firstname', 'yzc_change_bp_first_name_to_username', 10, 2 );
Posted by: Guest on September-12-2021

Code answers related to "REPLACE USERNAME BY NAME youzify"

Browse Popular Code Answers by Language