WordPress.org

Ready to get started?Download WordPress

Forums

Change to Pending, but no revision (2 posts)

  1. candybrie
    Member
    Posted 7 months ago #

    So I have to make sure whatever edits are made by someone with x user role are automatically pending. They aren't allowed to publish, but have to be able to edit others published work.

    I hooked onto wp_insert_post_data and added the below to change it to pending every time they make changes.

    if ('academic_editor' == $role ){
    
    			if(isset( $data['post_status'])) {
    				$data['post_status']= 'pending';	//set published status to pending review
    				$data['post_date'] = current_time('mysql');
    				$data['post_date_gmt'] = get_gmt_from_date($post_date);
    			}
    		}

    The problem is that, I am some how messing up the revision system. One of the main features we chose wordpress for was the compare revisions, so we definitely need that to work. Any insights on how to make the revisions work while making every post they edit change to pending?

  2. bcworkz
    Member
    Posted 7 months ago #

    Maybe there's some tragic flaw that I'm not seeing. Why don't you just take away the publish_post capability for that role? The edit_others_posts capability is separate from publishing. By default they are usually together in certain roles, but there's no reason you couldn't change it.

    Then you don't need the status change script and the revision system should then work for you.

Reply

You must log in to post.

About this Topic