[wp-hackers] Check if the administrator is logged in

Dion Hulse (dd32) wordpress at dd32.id.au
Wed Mar 31 06:31:43 UTC 2010


As an extension to that, You should only check for 'manage_options' when  
you're literally, after someone who can manage options.
If you're interested in knowing if the user can publish posts, use  
'publish_posts', if they can create users, 'create_users', etc.
Its always best to use the right capability for the right purpose.

For a (near full, but incomplete) listing of all the capabilities, see  
this page: http://codex.wordpress.org/Roles_and_Capabilities#Capabilities

Please also note, That page will list "level_*" capabilities, please do  
NOT use these. They stem from before WordPress 2.0, before the Roles and  
Capabilities functionality, they're not as flexible as capabilities and  
can lead to an incorrect assumption of what the user can actually do.

Cheers

Dion Hulse / dd32
Contact:
  e: contact at dd32.id.au
  Web: http://dd32.id.au/

On Wed, 31 Mar 2010 16:19:59 +1200, Dan Coulter <dan at dancoulter.com> wrote:

> http://markjaquith.wordpress.com/2006/03/27/how-to-check-if-a-wordpress-user-is-an-administrator/
>
> On Tue, Mar 30, 2010 at 10:53 PM, raj <websweetweb at gmail.com> wrote:
>
>> Hi,
>>
>> I am developing a plugin where I need to do this. How do you check if  
>> the
>> administrator is logged in?
>>
>> Raj


More information about the wp-hackers mailing list