[wp-hackers] What combination of roles to allow editing pages but not adding new ones?

Jeremy Clarke jer at simianuprising.com
Wed Jan 25 21:59:10 UTC 2012


On Sun, Jan 15, 2012 at 9:53 AM, Edward Prendergast
<edward at openedweb.co.uk>wrote:

>
> I'm trying to figure out what combination of capabilities are needed to
> allow an editor to still edit existing pages but not add new ones.
>
>
The edit_* capabilities control both creating new ones and editing those
you have rights to, there's no way to stop people from creating new posts
without removing the ability to edit them entirely.

That said, if you have edit_* without publish_* then you can't publish
posts, only 'submit for approval' which makes them 'pending' status. This
means that if users create posts they are effectively inert and it's easy
to enforce a 'no new posts' policy. It may be somewhat confusing to people
because the 'add new' link is still there, but the UI makes it clear that
they don't have permission to publish. If you wanted you could use jQuery
or something similar to remove the 'add new' links for people without the
publish_* capabilities. They would still be able to access the add new
screen if they visited it directly, but it would avoid the clutter and they
still wouldn't be able to publish anything.

I'll also note that it sounds like you need users with edit_others_*
capabilities as well, because you say 'editors'. By default you can only
edit posts that you are the author of, if you have edit_others_* then you
can edit them all. I think this will work even if the user doesn't have
publish_*, or at least it should (it's a rare use-case, and sometimes rare
combos of capabilities have unexpected results so test it carefully).

-- 
Jeremy Clarke • jeremyclarke.org
Code and Design • globalvoicesonline.org


More information about the wp-hackers mailing list