[wp-edu] Authors and permissions

Andrew Nacin wp at andrewnacin.com
Wed Sep 1 21:30:11 UTC 2010


On Wed, Sep 1, 2010 at 4:53 PM, Ken Newquist <newquisk at lafayette.edu> wrote:

> The only specific role tweak that's one our wish list is to allow Authors
> to create drafts of pages (which could then be published by Editors). Right
> now only Editors can draft and publish pages (which isn't in keeping with
> the Contributor -> Author progression, where contributors can create drafts
> of posts, but Authors can publish them; I'd love to see that progression
> replicated with Author -> Editor for pages).
>

Changing the functionality of a core role is not something we can really do,
even if that makes sense, for compatibility reasons.

It's actually a really simple plugin.  All you need to do is give Author the
edit_pages capability. Two ways to do it -- alter the role in the database,
or do a filter at runtime. No need to worry about plugin upgrades in that
case, or compatibility with changes to core.

This untested example modifies the roles definition in the DB:

class Nacin_Authors_Draft_Pages {
   function Nacin_Authors_Draft_Pages() {
      register_activation_hook( __FILE__, array( &$this, 'activate' ) );
      register_deactivation_hook( __FILE__, array( &$this, 'deactivate' ) );
   }
   function activate() {
      $role = &get_role( 'author' );
      $role->add_cap( 'edit_pages' );
   }
   function deactivate() {
      $role = &get_role( 'author' );
      $role->remove_cap( 'edit_pages' );
   }
}
new Nacin_Authors_Draft_Pages;
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.automattic.com/pipermail/wp-edu/attachments/20100901/500e74b4/attachment.htm>


More information about the wp-edu mailing list