有人知道如何从$user\\u id中获取first\\u name和last\\u name,以便传递到钩子user\\u寄存器上的函数中吗?
我在以下两方面都不走运:
function random_name ($user_id){
$new_user = get_userdata($user_id);
$user_email = $new_user -> user_email;
// get all the meta data of the newly registered user
$new_user_data = get_user_meta($user_id);
// get the first name of the user as a string
$user_firstname = get_user_meta( $user_id, \'first_name\', true );
// get the last name of the user as a string
$user_lastname = get_user_meta( $user_id, \'last_name\', true );
echo $user_firstname . $user_lastname . $user_email;
}
我正在尝试检索名字和姓氏的值,以便将它们传递到API帖子中,以便在外部API上填充Entry,但在编译API帖子时,我得到的只是电子邮件地址?
提前谢谢。