Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

I am designing a code that uses that involves a pluggin. I need to extract the current wordpress users username to fetch him special authorities. This extraction of the username is being done in a php file of the pluggin.

share|improve this question
    
What have tou tried already? –  Nicole Nov 12 '12 at 14:27

1 Answer 1

This is what you are looking for:

http://codex.wordpress.org/Function_Reference/get_currentuserinfo

<?php global $user_identity; 
get_currentuserinfo(); 
?> 

The username will be stored in the global variable $user_identity. If you are adding capabilities (I assume this is what is meant by 'special authorities') then it would make more sense to use the $user_ID global variable.

share|improve this answer
    
An answer should be more than just a link to an external site. Please add a solution. –  toscho Nov 12 '12 at 16:19
    
<?php global $user_identity; get_currentuserinfo(); ?> The username will be stored in the global variable $user_identity. If you are adding capabilities (I assume this is what is meant by 'special authorities') then it would make more sense to use the $user_ID global variable. –  Dom Nov 13 '12 at 8:45
    
Please edit your answer, don’t hide useful examples in comments. :) –  toscho Nov 13 '12 at 8:57

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.