[wp-hackers] checking roles in a plugin?
Keith Constable
kccricket at gmail.com
Fri Sep 7 02:47:11 GMT 2007
Mindshare Studios wrote:
> Hi -
>
> How can you do a simple role check within a plugin before echoing some
> content to the screen?
>
> I'm trying to do something like this:
>
> if (current_user_can('edit_posts')) {
> $var = 'sweet!';
> }
>
> But that isn't working at all. Any ideas?
Well, that's how you do it. Are you testing it as the administrator?
If not, are you absolutely sure that the user you're testing it as has
the edit_posts capability? Refer to Roles_and_Capabilities [1] on the
Codex to be sure.
[1] http://codex.wordpress.org/Roles_and_Capabilities
-Keith Constable
http://kccricket.net/
More information about the wp-hackers
mailing list