From 8ec74b23aab34e1e62693eb6b6626fe392e4864f Mon Sep 17 00:00:00 2001 From: Anderson Grudtner Martins Date: Fri, 4 Sep 2020 00:41:48 -0300 Subject: [PATCH 1/2] Fix call a member function add_cap on null Fix issue #223. --- src/core/Classes/Installer.php | 23 ++++++++++++++--------- 1 file changed, 14 insertions(+), 9 deletions(-) diff --git a/src/core/Classes/Installer.php b/src/core/Classes/Installer.php index c6e2cc84..be93c66e 100644 --- a/src/core/Classes/Installer.php +++ b/src/core/Classes/Installer.php @@ -24,6 +24,7 @@ namespace MultipleAuthors\Classes; use MultipleAuthors\Classes\Objects\Author; +use WP_Role; class Installer { @@ -215,15 +216,19 @@ protected static function flush_permalinks() private static function add_new_edit_post_authors_cap() { $cap = 'ppma_edit_post_authors'; - - $role = get_role('author'); - $role->add_cap($cap); - - $role = get_role('editor'); - $role->add_cap($cap); - - $role = get_role('contributor'); - $role->add_cap($cap); + $roles = [ + 'author', + 'editor', + 'contributor', + ]; + + foreach ($roles as $roleNmae) + { + $role = get_role($roleNmae); + if ($role instanceof WP_Role) { + $role->add_cap($cap); + } + } } /** From 091a552c45e7c280b660e6b2096a747a76879b98 Mon Sep 17 00:00:00 2001 From: Anderson Grudtner Martins Date: Fri, 4 Sep 2020 00:44:01 -0300 Subject: [PATCH 2/2] Preparing to release v3.6.3 --- defines.php | 2 +- publishpress-authors.php | 2 +- readme.txt | 6 +++++- 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/defines.php b/defines.php index a0cc1409..e2b4b939 100644 --- a/defines.php +++ b/defines.php @@ -12,7 +12,7 @@ defined('ABSPATH') or die('No direct script access allowed.'); if (!defined('PP_AUTHORS_VERSION')) { - define('PP_AUTHORS_VERSION', '3.6.2'); + define('PP_AUTHORS_VERSION', '3.6.3'); define('PP_AUTHORS_FILE', 'publishpress-authors/publishpress-authors.php'); define('PP_AUTHORS_BASE_PATH', plugin_dir_path(__DIR__ . '/publishpress-authors.php')); define('PP_AUTHORS_MODULES_PATH', PP_AUTHORS_BASE_PATH . 'src/modules/'); diff --git a/publishpress-authors.php b/publishpress-authors.php index d2dc677d..750c9437 100644 --- a/publishpress-authors.php +++ b/publishpress-authors.php @@ -5,7 +5,7 @@ * Description: PublishPress Authors allows you to add multiple authors and guest authors to WordPress posts * Author: PublishPress * Author URI: https://publishpress.com - * Version: 3.6.2 + * Version: 3.6.3 * Text Domain: publishpress-authors * * ------------------------------------------------------------------------------ diff --git a/readme.txt b/readme.txt index c3d29e1a..efd71066 100644 --- a/readme.txt +++ b/readme.txt @@ -7,7 +7,7 @@ Tags: multiple authors, authors, guest authors, author fields, author layouts Requires at least: 4.7 Requires PHP: 5.6 Tested up to: 5.5 -Stable tag: 3.6.2 +Stable tag: 3.6.3 License: GPLv2 or later License URI: http://www.gnu.org/licenses/gpl-2.0.html @@ -127,6 +127,10 @@ There are two ways to install the PublishPress Authors plugin: The format is based on [Keep a Changelog](http://keepachangelog.com/) and this project adheres to [Semantic Versioning v2.0.0](https://semver.org/spec/v2.0.0.html). += [3.6.3] - 2020-09-04 = + +* Fixed: Fix error "Uncaught Error: Call to a member function add_cap() on null", #223; + = [3.6.2] - 2020-09-03 = * Fixed: Fix error "Call to a member function get_error_message() on boolean", a regression bug result of the recent updates, #221;