jeudi 29 janvier 2015

get user id from username - buddyPress


I need to get the id of the user by searching it on the input field. lets say i need an id of the user 'adre'(which is 33 actually). Any help would be appreciated.



// this way i can get username with user id.
$user_ID = 33;
$user = new BP_Core_User( $user_ID );
$user_array = $user->profile_data;
echo $user_nicename=$user_array['user_nicename']; // adre

// now i need to get user id by username.
//echo bp_displayed_user_id();




Aucun commentaire:

Enregistrer un commentaire