diff --git a/admin/revision-action_rvy.php b/admin/revision-action_rvy.php index 0feaf6a..57e3bc7 100644 --- a/admin/revision-action_rvy.php +++ b/admin/revision-action_rvy.php @@ -32,7 +32,9 @@ function rvy_revision_create($post_id = 0, $args = []) { if (!empty($args['force']) || current_user_can('copy_post', $main_post_id)) { require_once( dirname(REVISIONARY_FILE).'/revision-creation_rvy.php' ); $rvy_creation = new PublishPress\Revisions\RevisionCreation(); - $revision_id = $rvy_creation->createRevision($post_id, 'draft-revision', $args); + + $revision_status = (rvy_get_option('auto_submit_revisions') && current_user_can('edit_post', $main_post_id)) ? 'pending-revision' : 'draft-revision'; + $revision_id = $rvy_creation->createRevision($post_id, $revision_status, $args); } else { $revision_id = 0; } diff --git a/revision-creation_rvy.php b/revision-creation_rvy.php index f18e2ab..98142bc 100644 --- a/revision-creation_rvy.php +++ b/revision-creation_rvy.php @@ -120,6 +120,14 @@ function createRevision($post_id, $revision_status, $args = []) { $post = get_post($revision_id); + if (('pending-revision' == $revision_status) && !defined('REVISONARY_AUTO_SUBMIT_NO_NOTIFICATION')) { + require_once( dirname(REVISIONARY_FILE).'/revision-workflow_rvy.php' ); + $rvy_workflow_ui = new \Rvy_Revision_Workflow_UI(); + + $args = ['revision_id' => $revision_id, 'published_post' => $published_post, 'object_type' => $published_post->post_type]; + $rvy_workflow_ui->do_notifications('pending-revision', 'pending-revision', (array) $published_post, $args ); + } + $url = apply_filters('revisionary_create_revision_redirect', rvy_admin_url("post.php?post=$revision_id&action=edit"), $revision_id); if (!empty($args['suppress_redirect'])) {