Can't retrieve first name with get_user_by data
-
Hi,
I’m trying to retrieve a user’s first name to insert into the body of an email. A form submits the username (
$taskowner) and the user’s email address is correctly retrieved from the database and inserted into the email header. However, I can’t get the users’s ‘first_name’ using:$task_owner_email = $wpdb->get_var("SELECT user_email FROM$wpdb->users` WHERE ID = $taskowner LIMIT 1″);$task_owner = get_user_by(’email’, $task_owner_email);
$user_firstname= $task_owner->first_name;`$task_owner_email, which is declared global, is correctly inserted in the email function but not$user_firstname, which is also declared global.Help please.
The topic ‘Can't retrieve first name with get_user_by data’ is closed to new replies.