From 4e075abc229347f4abcd7f400f7b86b3f7c84805 Mon Sep 17 00:00:00 2001 From: haideralibd Date: Mon, 2 Dec 2024 12:50:36 +0600 Subject: [PATCH 1/2] fix: translatepress infinite loop issue for checking capibility --- includes/Capability.php | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/includes/Capability.php b/includes/Capability.php index 342e802..c2844de 100644 --- a/includes/Capability.php +++ b/includes/Capability.php @@ -10,11 +10,11 @@ class Capability { * Initialize the class */ public function __construct() { - add_filter( 'user_has_cap', [ $this, 'grant_delete_capability_to_specific_roles' ], 10, 4 ); + add_filter( 'user_has_cap', array( $this, 'grant_delete_capability_to_specific_roles' ), 10, 4 ); } /** - * Grant doc delete capabilities to Admin, Editor and + * Grant doc delete capabilities to Admin, Editor and * weDocs-pro global permission given roles. * * @param array $all_caps An array of all the user's capabilities. @@ -25,13 +25,22 @@ public function __construct() { * @return array */ public function grant_delete_capability_to_specific_roles( $all_caps, $caps, $args, $user ) { + if ( ! isset( $_GET['post'] ) || 'docs' !== get_post_type( absint( $_GET['post'] ) ) ) { + return $all_caps; + } + $permitted_roles = array( 'administrator', 'editor' ); - $delete_caps = array( + $delete_caps = array( 'delete_published_docs' => true, + 'delete_docs' => true, 'delete_others_docs' => true, 'delete_private_docs' => true, ); + if ( empty( array_intersect( array_keys( $delete_caps ), $caps ) ) ) { + return $all_caps; + } + if ( wedocs_pro_exists() ) { $permitted_roles = wedocs_get_permission_settings( 'global_permission', [ 'administrator', 'editor' ] ); } From 1af76e5a4ca254d925bd920effd253f192ca2422 Mon Sep 17 00:00:00 2001 From: "Md. Aminur Islam" Date: Thu, 5 Dec 2024 13:02:38 +0600 Subject: [PATCH 2/2] :rocket: [CHORE] version 2.1.10 --- package.json | 4 ++-- readme.txt | 6 +++++- wedocs.php | 4 ++-- 3 files changed, 9 insertions(+), 5 deletions(-) diff --git a/package.json b/package.json index 8af4406..8f0de88 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "weDocs", - "version": "2.1.9", + "version": "2.1.10", "description": "A documentation plugin for WordPress", "author": "Tareq Hasan", "license": "GPL", @@ -58,4 +58,4 @@ "react-router-dom": "^6.6.2", "sweetalert2": "^11.7.1" } -} +} \ No newline at end of file diff --git a/readme.txt b/readme.txt index 1b053e7..e054cca 100644 --- a/readme.txt +++ b/readme.txt @@ -5,7 +5,7 @@ Tags: WordPress documentation plugin, WordPress docs plugin, Documentation, Know Requires at least: 5.6 Tested up to: 6.6.2 Requires PHP: 7.4 -Stable tag: 2.1.9 +Stable tag: 2.1.10 License: GPLv2 or later License URI: https://www.gnu.org/licenses/gpl-2.0.html @@ -343,6 +343,10 @@ Can’t wait to join us? == Changelog == += v2.1.10 (05th Dec, 2024) = + +* 🛠️ [FIX] Resolves "TranslatePress" conflict with editor's trash capability. + = v2.1.9 (31th Oct, 2024) = * 🪝 [ADD] Introduced the "weDocs - Docs Grid" block for displaying documents in a customizable grid view. diff --git a/wedocs.php b/wedocs.php index bf6c971..5c7b75e 100644 --- a/wedocs.php +++ b/wedocs.php @@ -3,7 +3,7 @@ Plugin Name: weDocs Plugin URI: https://wedocs.co/ Description: A documentation plugin for WordPress -Version: 2.1.9 +Version: 2.1.10 Author: weDevs Author URI: https://wedocs.co/?utm_source=wporg&utm_medium=banner&utm_campaign=author-uri License: GPL2 @@ -60,7 +60,7 @@ final class WeDocs { * * @var string */ - const VERSION = '2.1.9'; + const VERSION = '2.1.10'; /** * The plugin url.