Support » Plugins » Hacks » Check user role before proceeding

  • Brooke

    (@bandonrandon)


    I am working on a plugin and would like to check the users role before a certain action. I know I can use current_user_can() but this requires a checking against something like “edit_post” which works fine if only used from the code side. I however want the admin to be able to select a role from a drop down (like the current user role drop down on the user page) and then check against that role.

    Something like:
    if(user_role()=="editor"){//do something }

    This should be less confusing. I know that older versions of WordPress used user roles as numbers with admin being 10 I think this has been depreciated.

    Any Help would be great,
    Brooke

Viewing 3 replies - 1 through 3 (of 3 total)
Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Check user role before proceeding’ is closed to new replies.