I'm currently writing a plugin and need to know how to get the current username & id ive searched for about an hour but found nothing.
I'm currently writing a plugin and need to know how to get the current username & id ive searched for about an hour but found nothing.
Check out the setup_userdata function in wp-includes/user.php.
setup_userdata($current_user->ID);I'm trying to figure this out also...this code isn't working to get the logged in username (or email in this case):
$current_user = setup_userdata($current_user->ID);
echo $current_user->$user_email;
This is being executed by a plugin -not sure if that effects it.
Found this in Function_Reference/get_currentuserinfo
<?php global $user_ID;
get_currentuserinfo();
if ('' == $user_ID) {
//no user logged in
}
?>Also see you posted this and Andy replied:
http://comox.textdrive.com/pipermail/wp-hackers/2007-November/015942.html
<?php echo $user_identity; ?>
This topic has been closed to new replies.