diff --git a/admin/admin_rvy.php b/admin/admin_rvy.php index 2d0e7145..ad3395aa 100644 --- a/admin/admin_rvy.php +++ b/admin/admin_rvy.php @@ -179,6 +179,12 @@ public function fltDisableStatusControlScripts($enable_scripts) { } public function fltDisableExceptionUI($disable, $src_name, $post_id, $post_type = '') { + global $pagenow; + + if (!empty($pagenow) && ('term.php' == $pagenow)) { + return $disable; + } + if (!$post_id) { // Permissions version < 3.1.4 always passes zero value $post_id $post_id = rvy_detect_post_id(); diff --git a/admin/revision-action_rvy.php b/admin/revision-action_rvy.php index 8622aea5..6bb7294c 100644 --- a/admin/revision-action_rvy.php +++ b/admin/revision-action_rvy.php @@ -1100,6 +1100,8 @@ function rvy_publish_scheduled_revisions($args = array()) { // if it was not stored, or cleared, use default recipients $to_addresses = array(); + do_action('presspermit_init_rvy_interface'); + if ( defined('RVY_CONTENT_ROLES') && ! defined('SCOPER_DEFAULT_MONITOR_GROUPS') && ! defined('REVISIONARY_LIMIT_ADMIN_NOTIFICATIONS') ) { // e-mail to Scheduled Revision Montiors metagroup if Role Scoper is activated global $revisionary; diff --git a/readme.txt b/readme.txt index ac520447..aaa44d88 100644 --- a/readme.txt +++ b/readme.txt @@ -7,7 +7,7 @@ Tags: revision, submit changes, workflow, collaboration, permissions, moderate, Requires at least: 4.9.7 Requires PHP: 5.6.20 Tested up to: 5.7 -Stable tag: 2.5.2 +Stable tag: 2.5.3 License: GPLv2 or later License URI: http://www.gnu.org/licenses/gpl-2.0.html @@ -104,6 +104,12 @@ Follow PublishPress on [Facebook](https://www.facebook.com/publishpress), [Twitt == Changelog == += 2.5.3 - 5 Apr 2021 = +* Compat : WP Rest Cache - Revision submission from Gutenberg failed +* Compat : PublishPress Permissions - Edit Category / Term: Permissions metaboxes were not displayed +* Compat : PublishPress Permissions - Pending Revision Monitors group ineffective; notifications were sent to all Editors and Administrators (also requires PublishPress Permissions 3.5.1) +* Compat : Enable revisioning of non-public post types if they have type-specific capabilities defined + = 2.5.2 - 30 Mar 2021 = * Fixed : Fatal error due to incorrect vendor library load request diff --git a/revision-creation_rvy.php b/revision-creation_rvy.php index d5d1010c..b0b44cd1 100644 --- a/revision-creation_rvy.php +++ b/revision-creation_rvy.php @@ -176,7 +176,7 @@ function flt_pending_revision_data( $data, $postarr ) { if ( $revisionary->isBlockEditorActive() && !$revisionary->doing_rest ) { if (!empty($_REQUEST['meta-box-loader']) && !empty($_REQUEST['action']) && ('editpost' == $_REQUEST['action'])) { // Use logged revision ID from preceding REST query - if (!$revision_id = rvy_get_transient("_rvy_pending_revision_{$current_user->ID}_{$postarr['ID']}")) { + if (!$revision_id = (int) rvy_get_transient("_rvy_pending_revision_{$current_user->ID}_{$postarr['ID']}")) { return $data; } } else { @@ -515,7 +515,7 @@ function flt_create_scheduled_rev( $data, $post_arr ) { if ( $revisionary->isBlockEditorActive() && !$revisionary->doing_rest ) { if (!empty($_REQUEST['meta-box-loader']) && !empty($_REQUEST['action']) && ('editpost' == $_REQUEST['action'])) { // Use logged revision ID from preceding REST query - if (!$revision_id = rvy_get_transient("_rvy_scheduled_revision_{$current_user->ID}_{$post_arr['ID']}")) { + if (!$revision_id = (int) rvy_get_transient("_rvy_scheduled_revision_{$current_user->ID}_{$post_arr['ID']}")) { return $data; } } else { diff --git a/revision-workflow_rvy.php b/revision-workflow_rvy.php index 1cf8944e..0623ebbb 100644 --- a/revision-workflow_rvy.php +++ b/revision-workflow_rvy.php @@ -306,6 +306,8 @@ static function getRecipients($notification_class, $args) { case 'rev_submission_notify_admin' : case 'rev_approval_notify_admin' : + do_action('presspermit_init_rvy_interface'); + if ( defined('RVY_CONTENT_ROLES') && ! defined('SCOPER_DEFAULT_MONITOR_GROUPS') && ! defined('REVISIONARY_LIMIT_ADMIN_NOTIFICATIONS') ) { global $revisionary; diff --git a/revisionary.php b/revisionary.php index d1088f2b..461bd2fa 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: 2.5.2 + * Version: 2.5.3 * Text Domain: revisionary * Domain Path: /languages/ * Min WP Version: 4.9.7 @@ -96,7 +96,7 @@ function($links, $file) // register these functions before any early exits so normal activation/deactivation can still run with RS_DEBUG register_activation_hook(__FILE__, function() { - $current_version = '2.5.2'; + $current_version = '2.5.3'; $last_ver = get_option('revisionary_last_version'); @@ -172,7 +172,7 @@ function() return; } - define('REVISIONARY_VERSION', '2.5.2'); + define('REVISIONARY_VERSION', '2.5.3'); if ( ! defined( 'RVY_VERSION' ) ) { define( 'RVY_VERSION', REVISIONARY_VERSION ); // back compat diff --git a/revisionary_main.php b/revisionary_main.php index 2aa592f0..69b67b3e 100644 --- a/revisionary_main.php +++ b/revisionary_main.php @@ -168,8 +168,8 @@ function configurationLateInit() { } // This is intentionally called twice: once for code that fires on 'init' and then very late on 'init' for types which were registered late on 'init' - private function setPostTypes() { - $this->enabled_post_types = apply_filters( + public function setPostTypes() { + $enabled_post_types = apply_filters( 'revisionary_enabled_post_types', array_diff_key( array_merge( @@ -182,6 +182,21 @@ private function setPostTypes() { ) ); + if (!defined('REVISIONARY_NO_PRIVATE_TYPES')) { + $private_types = get_post_types(['public' => false], 'object'); + + // by default, enable non-public post types that have type-specific capabilities defined + foreach($private_types as $post_type => $type_obj) { + if ((!empty($type_obj->cap) && !empty($type_obj->cap->edit_posts) && !in_array($type_obj->cap->edit_posts, ['edit_posts', 'edit_pages'])) + || defined('REVISIONARY_ENABLE_' . strtoupper($post_type) . '_TYPE') + ) { + $enabled_post_types[$post_type] = true; + } + } + } + + $this->enabled_post_types = array_merge($this->enabled_post_types, $enabled_post_types); + unset($this->enabled_post_types['attachment']); $this->enabled_post_types = array_filter($this->enabled_post_types); } diff --git a/rvy_init.php b/rvy_init.php index c861f62f..1f115b24 100644 --- a/rvy_init.php +++ b/rvy_init.php @@ -255,12 +255,14 @@ function rvy_get_transient($transient) { $option_name = '_transient_' . $transient; - return $wpdb->get_var( + $val = $wpdb->get_var( $wpdb->prepare( "SELECT option_value FROM $wpdb->options WHERE option_name = %s", $option_name ) ); + + return (is_null($val)) ? '' : $val; } function rvy_set_transient($transient, $option_val, $timeout = 30) {