views:

31

answers:

1

I want to make a user class that can edit pages, and save them as a draft without being able to publish it. An admin would have to go in and publish the draft once they approve it.

The idea is similar to TDO Mini Forms except this will be done within the Wordpress admin panel, not be a form, and they must be a registered user in a specific class to do this.

Thanks!

+1  A: 

Install the Members Plugin, create a role for these users (or reuse the author role) and do not give them the publish_posts capability.

Here is a screenshot of how I handle this case on one of my clients site:

Screenshot Members Plugin

Update

To forbid publishing of edits you have to hook into the action transition_post_status and watch for changes. This actions tells you the old and the new post status and the post id:

add_action('transition_post_status', 'my_watcher', 10, 3);

function my_watcher($new_status, $old_status, $postid)
{
    // Get post content etc.
    $post = &get_post( $postid );

    // Compare the content and/or the status, do something.
}

In my case, this was overelaborate, plus we were afraid, users would feel patronized too much. I just made a dashboard widget¹ to list all changes for admins an editors. Now the users see their edits immediately live. The editors clean things up if needed. Works great. The users learn how to make good edits, that aren’t touched again, and the work for the editors declines over time. :)

¹ Be aware: All text strings are in German, you may have to edit them. I didn’t had the time for I18n, sorry.

toscho
I want them to be able to edit pages that are already published. The publish pages/posts options only doesn't let them publish a new page. I want them to be able to edit a published page, but not republish the new version. Thanks for the help!
Steven
I made an update for my answer, hope it helps a bit!
toscho
Okay so I added "transition_post_status" as a 'new capability' on the Members plugin. Do I uncheck it for the editors and then add it for admins and check it? Check it just for editors? Then where do I add that action stuff in? Sorry but I'm pretty new at all of this Wordpress plugin stuff. Thanks so much for the help, you're awesome!
Steven
`transition_post_status` is an [action](http://codex.wordpress.org/Plugin_API) not a capability. Actions are triggered by events like the onclick event in Javascript. The code example I gave goes into the functions.php of your theme or better yet into a plugin. The best place to dive into this problem is probably http://wordpress.stackexchange.com – I don’t have the time to write functional demo code.
toscho