I am trying to use information about the current user in a plugin that I am designing and I have seen people go about it in several different ways.
This way seems to work, but am I missing something?
global $current_user; // Use information echo "User ID: " . $current_user->user_id; echo "User First Name: " . $current_user->first_name;
I have seen some people call the function
get_currentuserinfo() on the next line after declaring the global variable $current_user. However, this seems to work without that call - so is it necessary?
Also, there is the function
wp_get_current_user() - what is the difference between this and
I have also seen people use a global variable called
$profileuser and use
get_user_to_edit() in order to set it to the user object. Is there some benefit to this?
I have also seen people refer directly to the
$user_ID global variable in addition to using the
$current_user. Why wouldn't they just use