[wp-hackers] User Capabilities

Ryan Boren ryan at boren.nu
Fri Jul 1 15:17:18 GMT 2005


On Fri, 2005-07-01 at 02:05 -0400, Mark Jaquith wrote:
> Ryan Boren wrote:
> 
> >// Don't let staff writers upload images.
> >$staff->remove_cap('upload_image');
> >
> Sir, I $staff->remove_cap('to_you')
> 
> </bad-bad-joke>
> 
> With edit_posts, it would be good to be able to specify if the role can 
> edit own posts only, own posts and posts of lower levels, own posts and 
> posts of same level.
> 
> For instance,
> 
> $collaborators = $wp_roles->get_role('collaborators');
> $collaborators->add_cap('edit_post_same_level');
> 
> Or something.  Sometimes you want people of the same level to be able to 
> edit each others posts, and sometimes you don't.  This would mean that 
> there would have to be some sort of way of specifying that certain 
> groups are "higher up" than others.

I'd prefer to get away from user levels entirely.  A user can either
edit other users' posts, or not.

A more useful and understandable model would be to limit roles to
categories.  A user would have a role and a list of categories to which
that role's post edit/create/publish capabilities would apply.  A
Managing Editor, for example, would have capabilities on all categories,
whereas a Copy Editor might have capabilities on only one or two
categories.  So, a Managing Editor could edit any user's posts and a
Copy Editor could edit other users' posts only within a set of
categories.

Ryan



More information about the wp-hackers mailing list