[wp-hackers] current_user_can() and roles ?

Frank Bueltge frank at bueltge.de
Wed Jan 6 19:05:30 UTC 2010


Thanks for your reply; i see this also! A in my plugin give the user
the rights on the option-field to the user-role, no own capabilitie. I
will only check, the loged in users have min. the role. I will not
check for a capabilies. Now i must check a capabilitie from this cole
and this is extra code and maybe dosnt work in feature when change WP
this capabilitie.


On Wed, Jan 6, 2010 at 7:48 PM, Jeremy Clarke <jer at simianuprising.com> wrote:
> On Wed, Jan 6, 2010 at 11:38 AM, Frank Bueltge <frank at bueltge.de> wrote:
>> Hello,
>>
>> the function current_user_can() has an paramter to give an object or role.
>> from the doc: @param string $capability Capability or role name.
>>
>> On my plugin it is not possible to ask with a role_name, only with the
>> capability or the level_[value]
>> Is this correct or is this a error on my mind?
>
> You should check with specific capabilities rather than with levels.
> Like edit_posts, edit_options. Then just specify in your plugin docs
> what capability users need to do certain things (or give a plugin
> setting where the needed capability is defined from a list).
>
> People who have custom roles will be confused by any use of levels,
> the level values are deprecated reverse-compatibility for the old
> system from before roles and capabilities were added.
>
> --
> Jeremy Clarke | http://jeremyclarke.org
> Code and Design | http://globalvoicesonline.org
> _______________________________________________
> wp-hackers mailing list
> wp-hackers at lists.automattic.com
> http://lists.automattic.com/mailman/listinfo/wp-hackers
>


More information about the wp-hackers mailing list