I have used a code to get Current user id in various part of template Pages.
Now i want to use the same code inside a plugin... But the same code which always worked like a charm is returning 0 rather than the logged in user id...
The code i use is below.
global $current_user; get_currentuserinfo(); echo $current_user->ID;
Is there anything wrong with the code, or do i have to make some changes in to it while using it inside a plugin.