How do I gain access to 'get_user_meta' function?
-
Hi everyone, I’m trying to create a simple plugin that access member data. I’m trying to use get_user_meta but nothing happens when I use this example:
<?php
$user_id = 9;
$key = ‘last_name’;
$single = true;
$user_last = get_user_meta( $user_id, $key, $single );
echo ‘<p>The ‘. $key . ‘ value for user id ‘ . $user_id . ‘ is: ‘ . $user_last . ‘</p>’;
?>My site is live so I’m testing using my email like this:
function myFunction()
{$user_id = 9;
$key = ‘last_name’;
$single = true;
$user_last = get_user_meta( $user_id, $key, $single );
echo ‘<p>The ‘. $key . ‘ value for user id ‘ . $user_id . ‘ is: ‘ . $user_last . ‘</p>’;$to=”[email protected]”;
$subject=”Subject”;
$message=”Message : “.$user_last;
mail($to,$subject,$message);
}add_action(‘wp_login’, ‘myFunction’);
Do I need some global variable to gain access to ‘get_user_meta’?
Thanks for any help.
- The topic ‘How do I gain access to 'get_user_meta' function?’ is closed to new replies.