bp_core_get_userid_from_nicename( string $user_nicename = '' )

Return the user ID based on a user’s user_nicename.


Description Description


Parameters Parameters

$user_nicename

(Optional) user_nicename to check.

Default value: ''


Top ↑

Return Return

(int|null) The ID of the matched user on success, null on failure.


Top ↑

Source Source

File: bp-members/bp-members-functions.php

298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
function bp_core_get_userid_from_nicename( $user_nicename = '' ) {
    if ( empty( $user_nicename ) ) {
        return false;
    }
 
    $user = get_user_by( 'slug', $user_nicename );
 
    /**
     * Filters the user ID based on user_nicename.
     *
     * @since 1.2.3
     *
     * @param int|null $value         ID of the user or null.
     * @param string   $user_nicename User nicename to check.
     */
    return apply_filters( 'bp_core_get_userid_from_nicename', ! empty( $user->ID ) ? $user->ID : NULL, $user_nicename );
}

Top ↑

Changelog Changelog

Changelog
Version Description
1.2.3 Introduced.

Top ↑

User Contributed Notes User Contributed Notes

You must log in before being able to contribute a note or feedback.