Tagged: 

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #1996
    rideforthebrand
    Participant

    Is there a way to allow a user to modify a page, but then when they go to update, it gets submitted for review? I know you can do this with Page Creation by unchecking Publish Page for that user role, but I want to allow access to modify the page, but then the Admin has to approve the update.

    #1998
    Vladimir
    Keymaster

    Try this code:

    
    add_action('save_post', 'submit_for_review_update', 25 );
    
    function submit_for_review_update($post_id) {
        
        if (empty($post_id)) {
            return;
        }
        
        $post = get_post($post_id);
        if (!is_object($post)) { 
            return;
        }
    
        if ($post->post_type=='revision') {
           return;
        }
        
        $current_user = wp_get_current_user();    
        if (in_array('author', $current_user->roles) && $post->post_status=='publish') {
            $my_post = array(
                'ID' => $post_id,
                'post_status' => 'pending',
            );
    
            remove_action('save_post', 'submit_for_review_update', 25);
            wp_update_post($my_post);
            add_action('save_post', 'submit_for_review_update', 25);
        }
    }
    
    #4407
    robfromerd
    Participant

    Hi.

    I implemented this but it seems to take the page down (no longer live) when I submit for review. Is there a way to keep the page live but submit the changes for review and then have an admin approve it later?

    #4408
    Vladimir
    Keymaster

    Hi,

    This more sophisticated way requires more coding. May be I will write such add-on with time.

    There is a plugin Revisionize which makes this. I did not tested it though.

Viewing 4 posts - 1 through 4 (of 4 total)
  • You must be logged in to reply to this topic.