Skip to content

Commit

Permalink
Merge pull request #663 from publishpress/release-3.0.13
Browse files Browse the repository at this point in the history
Release 3.0.13
  • Loading branch information
agapetry authored Mar 21, 2022
2 parents e1f2549 + c902734 commit 4c4dac8
Show file tree
Hide file tree
Showing 13 changed files with 70 additions and 35 deletions.
7 changes: 7 additions & 0 deletions admin/admin-dashboard_rvy.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
<?php
class RevisionaryDashboard {
public function __construct() {
}

public function recentPostsQueryArgs($query_args) {
add_filter('posts_clauses_request', [&$this, 'fltDashboardQueryClauses']);

Expand All @@ -13,6 +16,10 @@ public function fltDashboardQueryClauses( $clauses ) {
$post_types_csv = implode( "','", array_map('sanitize_key', $types));
$clauses['where'] = str_replace( "$wpdb->posts.post_type = 'post'", "$wpdb->posts.post_type IN ('$post_types_csv')", $clauses['where'] );

$clauses['where'] = str_replace( "$wpdb->posts.post_status = 'future'", "($wpdb->posts.post_status = 'future' OR ($wpdb->posts.post_status = 'pending' AND $wpdb->posts.post_mime_type = 'future-revision'))", $clauses['where'] );

$revisionary->is_revisions_query = false;

remove_filter('posts_clauses_request', [&$this, 'fltDashboardQueryClauses']);
return $clauses;
}
Expand Down
3 changes: 3 additions & 0 deletions admin/admin_rvy.php
Original file line number Diff line number Diff line change
Expand Up @@ -211,6 +211,9 @@ function limitRevisionEditorUI() {

function flt_dashboard_recent_posts_query_args($query_args) {
if ('future' == $query_args['post_status']) {
global $revisionary;
$revisionary->is_revisions_query = true;

require_once(dirname(__FILE__).'/admin-dashboard_rvy.php');
$rvy_dash = new RevisionaryDashboard();
$query_args = $rvy_dash->recentPostsQueryArgs($query_args);
Expand Down
16 changes: 10 additions & 6 deletions admin/revision-action_rvy.php
Original file line number Diff line number Diff line change
Expand Up @@ -586,8 +586,8 @@ function rvy_apply_revision( $revision_id, $actual_revision_status = '' ) {
);

if (
(in_array($revision->post_mime_type, ['pending-revision', 'draft-revision']) && !rvy_get_option('pending_revision_update_post_date'))
|| (('future-revision' == $revision->post_mime_type) && !rvy_get_option('scheduled_revision_update_post_date'))
(in_array($revision->post_mime_type, ['pending-revision', 'draft-revision']) && !rvy_filter_option('pending_revision_update_post_date', ['revision_id' => $revision_id, 'post_id' => $published->ID]))
|| (('future-revision' == $revision->post_mime_type) && !rvy_filter_option('scheduled_revision_update_post_date', ['revision_id' => $revision_id, 'post_id' => $published->ID]))
) {
// @todo: how was post_date_gmt of published post previously set to zero?
if (('0000-00-00 00:00:00' == $published->post_date_gmt) && ('0000-00-00 00:00:00' != $published->post_date)) {
Expand Down Expand Up @@ -660,8 +660,8 @@ function rvy_apply_revision( $revision_id, $actual_revision_status = '' ) {
}

if (
(in_array($revision->post_mime_type, ['draft-revision', 'pending-revision']) && rvy_get_option('pending_revision_update_modified_date'))
|| (('future-revision' == $revision->post_mime_type) && rvy_get_option('scheduled_revision_update_modified_date'))
(in_array($revision->post_mime_type, ['draft-revision', 'pending-revision']) && rvy_filter_option('pending_revision_update_modified_date', ['revision_id' => $revision_id, 'post_id' => $published->ID]))
|| (('future-revision' == $revision->post_mime_type) && rvy_filter_option('scheduled_revision_update_modified_date', ['revision_id' => $revision_id, 'post_id' => $published->ID]))
) {
$post_modified = current_time('mysql');
$post_modified_gmt = current_time('mysql', 1);
Expand All @@ -674,8 +674,8 @@ function rvy_apply_revision( $revision_id, $actual_revision_status = '' ) {
$update_fields['post_modified_gmt'] = $post_modified_gmt;

if (
(in_array($revision->post_mime_type, ['draft-revision', 'pending-revision']) && rvy_get_option('pending_revision_update_post_date'))
|| (('future-revision' == $revision->post_mime_type) && rvy_get_option('scheduled_revision_update_post_date'))
(in_array($revision->post_mime_type, ['draft-revision', 'pending-revision']) && rvy_filter_option('pending_revision_update_post_date', ['revision_id' => $revision_id, 'post_id' => $published->ID]))
|| (('future-revision' == $revision->post_mime_type) && rvy_filter_option('scheduled_revision_update_post_date', ['revision_id' => $revision_id, 'post_id' => $published->ID]))
) {
$update_fields['post_date'] = $post_modified;
$update_fields['post_date_gmt'] = $post_modified_gmt;
Expand Down Expand Up @@ -798,6 +798,10 @@ function rvy_apply_revision( $revision_id, $actual_revision_status = '' ) {
unset(presspermit()->flags['ignore_save_post']);
}
}

if (!defined('RVY_NO_AFTER_INSERT_ACTION') && !empty($_published)) {
do_action('wp_after_insert_post', $_published->ID, $_published, true, $published);
}
}

rvy_delete_past_revisions($revision_id);
Expand Down
9 changes: 4 additions & 5 deletions admin/rvy_revision-classic-edit.dev.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,10 @@ jQuery(document).ready( function($) {
var refSelector = 'div.misc-pub-section-last';
}

if (!$(refSelector).length) {
var refSelector = 'div.misc-pub-curtime';
}

if (rvyObjEdit.ajaxurl && !$('div.rvy-creation-ui').length && $(refSelector).length) {
$('#post-status-display').html(rvyObjEdit[rvyObjEdit.currentStatus + 'StatusCaption']);

Expand All @@ -35,10 +39,6 @@ jQuery(document).ready( function($) {

+ '&nbsp;<a href="' + rvyObjEdit[rvyObjEdit.currentStatus + 'CompletedURL'] + '" class="revision-preview" target="_blank">'
+ rvyObjEdit[rvyObjEdit.currentStatus + 'CompletedLinkCaption'] + '</a>'

+ '&nbsp;<a href="' + rvyObjEdit[rvyObjEdit.currentStatus + 'CompletedEditURL'] + '" class="revision-edit" target="_blank">'
+ rvyObjEdit[rvyObjEdit.currentStatus + 'CompletedEditLinkCaption'] + '</a>'

+ '</div>'

+ '</div> <br /><br />'
Expand Down Expand Up @@ -97,7 +97,6 @@ jQuery(document).ready( function($) {

$('#post-status-display').html(rvyObjEdit[rvyObjEdit.currentStatus + 'StatusCaption']);
$('a.revision-preview').attr('href', rvyObjEdit[rvyObjEdit.currentStatus + 'CompletedURL']).show();
$('a.revision-edit').attr('href', rvyObjEdit[rvyObjEdit.currentStatus + 'CompletedEditURL']).show();
}

var revisionaryCreateError = function (data, txtStatus) {
Expand Down
5 changes: 2 additions & 3 deletions admin/rvy_revision-classic-edit.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 4 additions & 0 deletions front_rvy.php
Original file line number Diff line number Diff line change
Expand Up @@ -428,7 +428,11 @@ function rvyPreviewJS() {
rvyAdminBarMenuZindex = barZ;
}
} else {
if (!empty($_REQUEST['et_fb']) && !defined('PP_REVISIONS_DIVI_NO_ADMIN_BAR') && function_exists('et_divi_replace_parent_stylesheet') && (!defined('ET_BUILDER_PRODUCT_VERSION') || version_compare(ET_BUILDER_PRODUCT_VERSION, '4.14.8', '<='))) {
var rvyAdminBarHeight = '32px';
} else {
var rvyAdminBarHeight = 0;
}
}

$('div.rvy_view_revision').css('position', 'fixed').css('top', '32px');
Expand Down
4 changes: 2 additions & 2 deletions functions.php
Original file line number Diff line number Diff line change
Expand Up @@ -136,12 +136,12 @@ function revisionary_copy_postmeta($from_post, $to_post_id, $args = []) {
$meta_keys = array_diff( $source_meta_keys, $meta_excludelist );
}

$target_meta_keys = \get_post_custom_keys( $to_post_id );
$target_meta_keys = (array) \get_post_custom_keys( $to_post_id );

$meta_keys = apply_filters('revisionary_create_revision_meta_keys', $meta_keys);

foreach ( $meta_keys as $meta_key ) {
if ($empty_target_only) {
if ($empty_target_only && !empty($target_meta_keys) && is_array($target_meta_keys)) {
if (in_array($meta_key, $target_meta_keys)) {
continue;
}
Expand Down
33 changes: 19 additions & 14 deletions readme.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ Tags: revision, submit changes, duplicate post, duplicate page, revisions, appro
Requires at least: 4.9.7
Requires PHP: 5.6.20
Tested up to: 5.9
Stable tag: 3.0.12
Stable tag: 3.0.13
License: GPLv2 or later
License URI: http://www.gnu.org/licenses/gpl-2.0.html

Expand All @@ -26,13 +26,11 @@ Your users can update posts using the normal WordPress editor, but their changes

## Submit Change Requests for Posts ####
PublishPress Revisions allows your users to submit change requests for published posts. Your users can update posts using the normal WordPress editor, but their changes will not be published automatically. Instead, the changes are stored as a "pending revision" that can be approved or rejected.

[Click here to see how to submit revisions](https://publishpress.com/knowledge-base/revisions-start/).

## Schedule Future Updates to Posts ##

PublishPress Revisions allows you to schedule WordPress revisions to be published in the future. When you're editing a published post, all you need to do is select a future date and click "Schedule Revision". Your changes will be published at the specified time.

[Click here to see how to schedule revisions](https://publishpress.com/knowledge-base/schedule-revisions-future/).

## Manage and Moderate Changes to Content ##
Expand All @@ -43,19 +41,16 @@ After you create a revision with PublishPress Revisions, you can find that revis

## Compare Current and Former Versions ##
Pending and Scheduled Revisions can include changes to post content, categories, tags, featured image, page parent and other options. Each of these changes can be reviewed in the familiar Compare Revisions interface.

[Click here to see how to compare revisions](https://publishpress.com/knowledge-base/compare-revisions/).

## Frontend Moderation of Content Changes ##

It is possible to preview and moderate revisions via the frontend of your WordPress site. If you click Preview for a pending revision, you'll see a toolbar across the frontend of the site. This toolbar will change color so you can easily know the status of the revision. For example, if you're looking at a pending revision, the toolbar will be green. For scheduled revisions, the toolbar will be grey.

[Click here to see how to manage from the frontend of your site](https://publishpress.com/knowledge-base/publishing-revisions-frontend/).

## Email Notifications for Revisions ##

PublishPress Revisions will notify Administrators and Editors when a new revision is submitted. They can log in to preview, compare and approve the changes. PublishPress Revisions can also send emails for revision approval and publication. The Settings screen lets you disable unwanted notifications.

[Click here for more on revision notifications](https://publishpress.com/knowledge-base/emails-revisionary/).

## Additional Plugins Supported in the Pro Version ##
Expand Down Expand Up @@ -88,7 +83,6 @@ PublishPress Revisions works with the default WordPress user roles, and also int
To schedule changes to a published post, just set the desired future date before hitting Update.

By upgrading to Revisions Pro, you also gain advanced permissions control through the PublishPress Permissions Pro plugin. You can customize permissions by role or per-user, granting full editing or revision submission rights to specific posts, categories, or taxonomy terms.

[Click here for more on revision permissions](https://publishpress.com/knowledge-base/permissions-revisions).

## Join PublishPress and get the Pro plugins ##
Expand Down Expand Up @@ -237,6 +231,17 @@ Divi is one of the most popular page-builders in WordPress, and it does integrat

== Changelog ==

= 3.0.13 - 21 Mar 2022 =
* Fixed : Revision submission in Classic Editor caused "Undefined" link next to "Preview" link
* Fixed : New revisions created with "Auto-submit" option had wrong date (and listing order) in Revision Queue
* Fixed : PHP error on revision approval under some configurations
* Fixed : Dashboard Activity widget: Scheduled revisions were not included in Publishing Soon list
* Fixed : API: wp_after_insert_post action was not applied at revision publication
* Compat : Divi - Revision preview bar not visible on front end
* Compat : Divi - Classic Editor setting did not trigger correct Revisions UI
* Compat : Custom post types - revision submission button not displayed in some configurations
* API: New filters pp_revisions_option_pending_revision_update_post_date, ​pp_revisions_option_pending_revision_update_modified_date, ​pp_revisions_option_scheduled_revision_update_post_date​, ​pp_revisions_option_scheduled_revision_update_modified_date

= 3.0.12 - 3 Mar 2022 =
* Feature : Edit link in post editor after revision creation / scheduling
* Change : Option to auto-submit revisions created by users who can publish the main post
Expand Down Expand Up @@ -312,11 +317,11 @@ Divi is one of the most popular page-builders in WordPress, and it does integrat
* 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
* Feature: Admin Bar includes "New Revision" button
* Change: Revision Queue filter captions
* Compat: Permissions - revise_others_posts, revise_others_pages, etc. capabilties are equivalent to list_others capabilities in allowing uneditable items to be listed
* 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
* Feature : Admin Bar includes "New Revision" button
* Change : Revision Queue filter captions
* Compat : Permissions - revise_others_posts, revise_others_pages, etc. capabilties are equivalent to list_others capabilities in allowing uneditable items to be listed
* Change : Include upload_files capability in the Revisor role

= 2.6.3 - 11 Oct 2021 =
Expand Down Expand Up @@ -575,7 +580,7 @@ Divi is one of the most popular page-builders in WordPress, and it does integrat
* Lang : Correct textdomain on numerous translation calls
* Lang : Improve translation string construction
* Lang : Support translation of Revisor role name
* Lang: Updated language files
* Lang : Updated language files

= 2.1.7 - 13 Jan 2020 =
* Fixed : Excessive resource usage with some caching solutions
Expand Down Expand Up @@ -644,7 +649,7 @@ Divi is one of the most popular page-builders in WordPress, and it does integrat
* Fixed : Classic Editor - Invalid Revisions > Browse link displayed to Revisors
* Compat : Classic Editor plugin - with "Allow users to switch editors" enabled, non-default editor did not have correct javascript loaded for Revisions
* Compat : On themes that use a fixed position header, display preview top bar above header
* Compat : PressPermit Pro - revision preview could not be viewed by Contributors under some configurations
* Compat : PressPermit Pro - revision preview could not be viewed by Contributors under some configurations
* Fixed : On standard Compare Revisions screen (for past revisions), Preview and Manage button links did not update with slider selection change
* Fixed : Pending, Schedule Revision notification - invalid preview link in some emails
* Fixed : Trashed revisions were not identified as revisions in Edit Posts listing
Expand Down
6 changes: 5 additions & 1 deletion revision-creation_rvy.php
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,11 @@ private function insert_revision($data, $base_post_id, $revision_status, $args =
return new \WP_Error(__( 'Could not insert revision into the database', 'revisionary'));
}

$wpdb->update($wpdb->posts, ['comment_count' => $base_post_id], ['ID' => $revision_id]);
$update_data = ('pending-revision' == $data['post_mime_type']) //
? ['comment_count' => $base_post_id, 'post_modified_gmt' => $data['post_modified_gmt'], 'post_modified' => $data['post_modified']]
: ['comment_count' => $base_post_id];

$wpdb->update($wpdb->posts, $update_data, ['ID' => $revision_id]);

// Use the newly generated $post_ID.
$where = array( 'ID' => $revision_id );
Expand Down
4 changes: 2 additions & 2 deletions revisionary.php
Original file line number Diff line number Diff line change
Expand Up @@ -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.12
* Version: 3.0.13
* Text Domain: revisionary
* Domain Path: /languages/
* Min WP Version: 4.9.7
Expand Down Expand Up @@ -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.12';
$pp_revisions_version = '3.0.13';

if( basename(__FILE__) == basename(esc_url_raw($_SERVER['SCRIPT_FILENAME'])) )
die( 'This page cannot be called directly.' );
Expand Down
Loading

0 comments on commit 4c4dac8

Please sign in to comment.