diff --git a/admin/post-editor-workflow-ui_rvy.php b/admin/post-editor-workflow-ui_rvy.php
index 9ae704b1..2177a0e1 100644
--- a/admin/post-editor-workflow-ui_rvy.php
+++ b/admin/post-editor-workflow-ui_rvy.php
@@ -28,6 +28,8 @@ public static function revisionLinkParams($args = []) {
'onApprovalCaption' => __('(on approval)', 'revisionary'),
];
+ $vars['disableRecaption'] = is_plugin_active('gutenberg/gutenberg.php');
+
if (rvy_get_option('revision_preview_links') || current_user_can('administrator') || is_super_admin()) {
$vars['viewURL'] = rvy_preview_url($post);
$can_publish = current_user_can('edit_post', rvy_post_id($post->ID));
@@ -165,6 +167,7 @@ public static function postLinkParams($args = []) {
'completedURL' => rvy_nc_url( add_query_arg('get_new_revision', $post->ID, get_permalink($post->ID))),
'errorCaption' => __('Error Creating Revision', 'revisionary'),
'ajaxurl' => rvy_admin_url(''),
+ 'update' => __('Update', 'revisionary'),
'postID' => $post->ID
));
} else {
@@ -182,6 +185,7 @@ public static function postLinkParams($args = []) {
'scheduledCaption' => pp_revisions_status_label('future-revision', 'submitted'),
'scheduledLinkCaption' => __('Preview', 'revisionary'),
'scheduledURL' => rvy_nc_url( add_query_arg('get_new_revision', $post->ID, get_permalink($post->ID))),
+ 'update' => __('Update', 'revisionary'),
));
}
diff --git a/admin/rvy_post-classic-edit.dev.js b/admin/rvy_post-classic-edit.dev.js
index 4f29a6df..ad556971 100644
--- a/admin/rvy_post-classic-edit.dev.js
+++ b/admin/rvy_post-classic-edit.dev.js
@@ -101,7 +101,7 @@ jQuery(document).ready( function($) {
});
}
- $(document).on('click', 'div.postbox-container', function() {
+ $(document).on('click', '#normal-sortables input, #normal-sortables select', function() {
$('a.revision-create').attr('disabled', 'disabled');
$('a.revision-schedule').attr('disabled', 'disabled');
});
@@ -207,6 +207,7 @@ jQuery(document).ready( function($) {
}
}
+ $('#publish').val(rvyObjEdit.update);
$('#publish').show();
}
}
diff --git a/admin/rvy_post-classic-edit.js b/admin/rvy_post-classic-edit.js
index 6b222f98..ca4d4347 100644
--- a/admin/rvy_post-classic-edit.js
+++ b/admin/rvy_post-classic-edit.js
@@ -17,11 +17,11 @@ $(document).on('click','a.revision-create',function(){if($('a.revision-create').
$('a.revision-create').attr('disabled','disabled');if(wp.autosave&&wp.autosave.server.postChanged()){var tmoRevisionSubmit=setTimeout(rvyCopyPost,5000);var intRevisionSubmit=setInterval(function(){if(!wp.autosave.server.postChanged()){clearTimeout(tmoRevisionSubmit);clearInterval(intRevisionSubmit);rvyCopyPost();}},250);wp.autosave.server.triggerSave();}else{rvyCopyPost();}});function rvyCopyPost(){var revisionaryCreateDone=function(){$('.revision-create').hide();$('.revision-created-wrapper').show();$('div.revision-created-wrapper a.revision-edit').attr('href',rvyObjEdit.completedURL);$('a.revision-create').removeAttr('disabled');}
var revisionaryCreateError=function(data,txtStatus){$('div.rvy-creation-ui').html(rvyObjEdit.errorCaption);}
var data={'rvy_ajax_field':'create_revision','rvy_ajax_value':rvyObjEdit.postID,'rvy_date_selection':RvyTimeSelection,'nc':RvyGetRandomInt(99999999)};$.ajax({url:rvyObjEdit.ajaxurl,data:data,dataType:"html",success:revisionaryCreateDone,error:revisionaryCreateError});}
-$(document).on('click','div.postbox-container',function(){$('a.revision-create').attr('disabled','disabled');$('a.revision-schedule').attr('disabled','disabled');});$(document).on('click','a.revision-schedule',function(){if($('a.revision-schedule').attr('disabled')){return;}
+$(document).on('click','#normal-sortables input, #normal-sortables select',function(){$('a.revision-create').attr('disabled','disabled');$('a.revision-schedule').attr('disabled','disabled');});$(document).on('click','a.revision-schedule',function(){if($('a.revision-schedule').attr('disabled')){return;}
$('a.revision-schedule').attr('disabled','disabled');if(wp.autosave.server.postChanged()){wp.autosave.server.triggerSave();var approvalDelay=250;}else{var approvalDelay=1;}
var revisionaryScheduleDone=function(){$('.revision-schedule').hide();$('.revision-scheduled-wrapper').show();$('div.revision-scheduled-wrapper a.revision-edit').attr('href',rvyObjEdit.scheduledURL);$('a.revision-schedule').removeAttr('disabled');}
var revisionaryScheduleError=function(data,txtStatus){$('div.rvy-creation-ui').html(rvyObjEdit.errorCaption);}
var tmoSubmit=setInterval(function(){if(!wp.autosave.server.postChanged()){var data={'rvy_ajax_field':'create_scheduled_revision','rvy_ajax_value':rvyObjEdit.postID,'rvy_date_selection':RvyTimeSelection,'nc':RvyGetRandomInt(99999999)};$.ajax({url:rvyObjEdit.ajaxurl,data:data,dataType:"html",success:revisionaryScheduleDone,error:revisionaryScheduleError});clearInterval(tmoSubmit);}},approvalDelay);});$(document).on('click','#post-body-content *, #content_ifr *, #wp-content-editor-container *, #tinymce *, #submitpost, span.revision-created',function(){RvyRefreshScheduleButton();});var RvySelectedFutureDate=false;var RvyTimeSelection='';var RvyRefreshScheduleButton=function(){var selectedDateHTML=$('#timestamp').html();if(!/\d/.test(selectedDateHTML)||!rvyIsPublished){RvyTimeSelection='';$('.rvy-creation-ui .revision-schedule').hide();$('.rvy-creation-ui .revision-scheduled-wrapper').hide();$('.rvy-creation-ui .revision-created-wrapper').hide();$('.rvy-creation-ui .revision-create').show();return;}
var dateStr=$('#mm').val()+'/'+$('#jj').val()+'/'+$('#aa').val()+' '+$('#hh').val()+':'+$('#mn').val()+':00';var selectedDate=new Date(dateStr);RvyTimeSelection=selectedDate.getTime();var tdiff=RvyTimeSelection-Date.now();RvyTimeSelection=RvyTimeSelection/1000;if((tdiff>1000)){RvySelectedFutureDate=true;$('.rvy-creation-ui .revision-create').hide();$('.rvy-creation-ui .revision-created-wrapper').hide();$('.rvy-creation-ui .revision-scheduled-wrapper').hide();$('.rvy-creation-ui .revision-schedule').show();$('#publish').hide();}else{$('.rvy-creation-ui .revision-schedule').hide();$('.rvy-creation-ui .revision-scheduled-wrapper').hide();$('.rvy-creation-ui .revision-created-wrapper').hide();$('.rvy-creation-ui .revision-create').show();if(tdiff<=0){if(RvySelectedFutureDate){RvyTimeSelection='';}}
-$('#publish').show();}}
+$('#publish').val(rvyObjEdit.update);$('#publish').show();}}
$(document).on('click','a.save-timestamp, a.cancel-timestamp',function(){RvyRefreshScheduleButton();});});
\ No newline at end of file
diff --git a/admin/rvy_revision-block-edit.dev.js b/admin/rvy_revision-block-edit.dev.js
index 47e444b6..5f39516f 100644
--- a/admin/rvy_revision-block-edit.dev.js
+++ b/admin/rvy_revision-block-edit.dev.js
@@ -7,6 +7,10 @@
*/
jQuery(document).ready( function($) {
function RvyRecaptionElement(btnSelector, btnCaption, btnIcon = '') {
+ if (rvyObjEdit.disableRecaption) {
+ return;
+ }
+
let node = document.querySelector(btnSelector);
if (node) {
@@ -313,7 +317,8 @@ jQuery(document).ready( function($) {
var RvyRecaptionSaveDraft = function() {
if ($('button.editor-post-save-draft:not(.rvy-recaption)').length) {
RvyRecaptionElement('button.editor-post-save-draft:not(.rvy-recaption)', rvyObjEdit.saveRevision);
- $('button.editor-post-save-draft:not(.rvy-recaption)').addClass('rvy-recaption').removeClass('is-tertiary').addClass('is-secondary').addClass('ppr-purple-button');
+
+ $('button.editor-post-save-draft:not(.rvy-recaption)').addClass('rvy-recaption').removeClass('is-tertiary').addClass('is-primary').addClass('ppr-purple-button');
}
if (($('div.edit-post-header__settings a.editor-post-preview:visible').length || $('div.block-editor-post-preview__dropdown button.block-editor-post-preview__button-toggle:visible').length) && !$('a.rvy-post-preview').length) {
diff --git a/admin/rvy_revision-block-edit.js b/admin/rvy_revision-block-edit.js
index f3f888e1..9cd7db8a 100644
--- a/admin/rvy_revision-block-edit.js
+++ b/admin/rvy_revision-block-edit.js
@@ -1,4 +1,5 @@
-jQuery(document).ready(function($){function RvyRecaptionElement(btnSelector,btnCaption,btnIcon=''){let node=document.querySelector(btnSelector);if(node){document.querySelector(btnSelector).innerText=`${btnCaption}`;if(btnIcon){document.querySelector(btnSelector).innerHTML=`${btnCaption}`;}}}
+jQuery(document).ready(function($){function RvyRecaptionElement(btnSelector,btnCaption,btnIcon=''){if(rvyObjEdit.disableRecaption){return;}
+let node=document.querySelector(btnSelector);if(node){document.querySelector(btnSelector).innerText=`${btnCaption}`;if(btnIcon){document.querySelector(btnSelector).innerHTML=`${btnCaption}`;}}}
function RvySetPublishButtonCaption(caption,waitForSaveDraftButton,forceRegen,timeout){if(caption==''&&(typeof rvyObjEdit['publishCaptionCurrent']!='undefined')){caption=rvyObjEdit.publishCaptionCurrent;}else{rvyObjEdit.publishCaptionCurrent=caption;}
if(typeof waitForSaveDraftButton=='undefined'){waitForSaveDraftButton=false;}
if((!waitForSaveDraftButton||$('button.editor-post-switch-to-draft').filter(':visible').length||$('button.editor-post-save-draft').filter(':visible').length)&&$('button.editor-post-publish-button').length){RvyRecaptionElement('button.editor-post-publish-button',caption);}}
diff --git a/functions.php b/functions.php
index 8f02d240..8225952e 100644
--- a/functions.php
+++ b/functions.php
@@ -244,7 +244,16 @@ function rvy_admin_url($partial_admin_url) {
function pp_revisions_plugin_updated($current_version) {
$last_ver = get_option('revisionary_last_version');
- if (version_compare($last_ver, '3.0-rc7', '<')) {
+ if (version_compare($last_ver, '3.0.1', '<')) {
+ // convert pending / scheduled revisions to v3.0 format
+ global $wpdb;
+ $revision_status_csv = rvy_revision_statuses(['return' => 'csv']);
+ $wpdb->query("UPDATE $wpdb->posts SET post_mime_type = post_status WHERE post_status IN ($revision_status_csv)");
+ $wpdb->query("UPDATE $wpdb->posts SET post_status = 'draft' WHERE post_status IN ('draft-revision')");
+ $wpdb->query("UPDATE $wpdb->posts SET post_status = 'pending' WHERE post_status IN ('pending-revision')");
+ $wpdb->query("UPDATE $wpdb->posts SET post_status = 'future' WHERE post_status IN ('future-revision')");
+
+ } elseif (version_compare($last_ver, '3.0-rc7', '<')) {
if ($role = @get_role('administrator')) {
$role->add_cap('manage_unsubmitted_revisions');
}
@@ -252,8 +261,8 @@ function pp_revisions_plugin_updated($current_version) {
if ($role = @get_role('revisor')) {
$role->add_cap('upload_files');
}
-
}
+
/*
elseif (version_compare($last_ver, '2.4.3-beta4', '<')) { // Empty Queue condition was reported with Elementor, so default this setting
if (defined('ELEMENTOR_VERSION') || defined('ELEMENTOR_PRO_VERSION')) {
diff --git a/readme.txt b/readme.txt
index 981953b6..f70fd227 100644
--- a/readme.txt
+++ b/readme.txt
@@ -7,7 +7,7 @@ Tags: revision, submit changes, workflow, collaboration, schedule revisions
Requires at least: 4.9.7
Requires PHP: 5.6.20
Tested up to: 5.8
-Stable tag: 3.0
+Stable tag: 3.0.1
License: GPLv2 or later
License URI: http://www.gnu.org/licenses/gpl-2.0.html
@@ -118,6 +118,15 @@ Follow PublishPress on [Facebook](https://www.facebook.com/publishpress), [Twitt
== Changelog ==
+= 3.0.1 - 10 Nov 2021 =
+* Fixed : Revisions created using Revisions 2.x were not listed in Revision Queue until plugin de/re-activation
+* Fixed : Front Page setting was cleared at revision submission on some sites
+* Fixed : Front Page setting dropdown in Settings > Reading included revisions
+* Fixed : Classic Editor : Schedule Revisions could not be submitted
+* Fixed : Classic Editor : Schedule button was displayed incorrectly while selecting a future date for scheduled revision
+* Compat : Gutenberg plugin - Edit Revision screen crashed on update attempt
+* API: Allow redirect to be disabled on revision creation
+
= 3.0 - 9 Nov 2021 =
* Feature: New revision submission mechanism: create an unsubmitted revision first instead of editing existing post. Edit revision directly, then submit for scheduling or publication.
* Change: Revisions UI in Post / Revision editor
diff --git a/revision-creation_rvy.php b/revision-creation_rvy.php
index 92ac6ac4..4d2b8f55 100644
--- a/revision-creation_rvy.php
+++ b/revision-creation_rvy.php
@@ -114,6 +114,10 @@ function createRevision($post_id, $revision_status, $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'])) {
+ return $url;
+ }
+
wp_redirect($url);
exit;
}
diff --git a/revisionary.php b/revisionary.php
index 78a6bb80..a5d532b6 100644
--- a/revisionary.php
+++ b/revisionary.php
@@ -5,7 +5,7 @@
* Description: Maintain published content with teamwork and precision using the Revisions model to submit, approve and schedule changes.
* Author: PublishPress
* Author URI: https://publishpress.com
- * Version: 3.0
+ * Version: 3.0.1
* Text Domain: revisionary
* Domain Path: /languages/
* Min WP Version: 4.9.7
@@ -36,7 +36,7 @@
// Temporary usage within this module only; avoids multiple instances of version string
global $pp_revisions_version;
-$pp_revisions_version = '3.0';
+$pp_revisions_version = '3.0.1';
if( basename(__FILE__) == basename($_SERVER['SCRIPT_FILENAME']) )
die( 'This page cannot be called directly.' );
diff --git a/revisionary_main.php b/revisionary_main.php
index 1442c613..745b2bc1 100644
--- a/revisionary_main.php
+++ b/revisionary_main.php
@@ -123,7 +123,10 @@ function addFilters() {
add_action('post_updated', [$this, 'actUpdateRevision'], 10, 2);
add_action('post_updated', [$this, 'actUpdateRevisionFixCommentCount'], 999, 2);
- add_filter("option_page_on_front", [$this, 'fltOptionPageOnFront']);
+ // This filter may be required in some configurations, but problematic in others
+ if (defined('PP_REVISIONS_PAGE_ON_FRONT_FILTER')) {
+ add_filter("option_page_on_front", [$this, 'fltOptionPageOnFront']);
+ }
add_filter('posts_clauses', [$this, 'fltPostsClauses'], 10, 2);
@@ -131,9 +134,72 @@ function addFilters() {
add_action('admin_bar_menu', [$this, 'adminToolbarItem'], 100);
}
+ add_filter('wp_dropdown_pages', [$this, 'fltDropdownPages'], 10, 3);
+
do_action( 'rvy_init', $this );
}
+ // Work around unfilterable get_pages() query by replacing the wp_dropdown_pages() return array
+ function fltDropdownPages($output, $parsed_args, $pages) {
+ // ---- Begin PublishPress Modification ---
+ global $wpdb;
+
+ // don't recursively execute this filter
+ remove_filter('wp_dropdown_pages', [$this, 'fltDropdownPages'], 10, 3);
+
+ $parse_args['echo'] = 0;
+
+ $revision_status_csv = rvy_revision_statuses(['return' => 'csv']);
+ $parsed_args['exclude'] = $wpdb->get_col("SELECT ID FROM $wpdb->posts WHERE post_mime_type IN ($revision_status_csv)");
+ // ---- End PublishPress Modification ---
+
+ $pages = get_pages( $parsed_args );
+ $output = '';
+ // Back-compat with old system where both id and name were based on $name argument.
+ if ( empty( $parsed_args['id'] ) ) {
+ $parsed_args['id'] = $parsed_args['name'];
+ }
+
+ if ( ! empty( $pages ) ) {
+ $class = '';
+ if ( ! empty( $parsed_args['class'] ) ) {
+ $class = " class='" . esc_attr( $parsed_args['class'] ) . "'";
+ }
+
+ $output = "\n";
+ }
+
+ /**
+ * Filters the HTML output of a list of pages as a drop down.
+ *
+ * @since 2.1.0
+ * @since 4.4.0 `$parsed_args` and `$pages` added as arguments.
+ *
+ * @param string $output HTML output for drop down list of pages.
+ * @param array $parsed_args The parsed arguments array. See wp_dropdown_pages()
+ * for information on accepted arguments.
+ * @param WP_Post[] $pages Array of the page objects.
+ */
+ $html = apply_filters( 'wp_dropdown_pages', $output, $parsed_args, $pages );
+
+ if ( $parsed_args['echo'] ) {
+ echo $html;
+ }
+
+ // PublishPress: restore this filter hook
+ add_filter('wp_dropdown_pages', [$this, 'fltDropdownPages'], 10, 3);
+
+ return $html;
+ }
+
function adminToolbarItem($admin_bar) {
global $post;