Skip to content

Commit

Permalink
Merge pull request #197 from publishpress/release-v3.5.1
Browse files Browse the repository at this point in the history
Release v3.5.1
  • Loading branch information
andergmartins authored Aug 20, 2020
2 parents 4c4b427 + cd1d71c commit 19ea5de
Show file tree
Hide file tree
Showing 16 changed files with 825 additions and 107 deletions.
72 changes: 37 additions & 35 deletions composer.lock

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

4 changes: 2 additions & 2 deletions publishpress-authors.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@
/**
* Plugin Name: PublishPress Authors
* Plugin URI: https://wordpress.org/plugins/publishpress-authors/
* Description: Add support for multiple authors
* Description: PublishPress Authors allows you to add multiple authors and guest authors to WordPress posts
* Author: PublishPress
* Author URI: https://publishpress.com
* Version: 3.5.0
* Version: 3.5.1
* Text Domain: publishpress-authors
*
* ------------------------------------------------------------------------------
Expand Down
14 changes: 12 additions & 2 deletions readme.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ Author URI: https://publishpress.com
Tags: multiple authors, authors, guest authors, author fields, author layouts
Requires at least: 4.7
Requires PHP: 5.6
Tested up to: 5.4
Stable tag: 3.5.0
Tested up to: 5.5
Stable tag: 3.5.1
License: GPLv2 or later
License URI: http://www.gnu.org/licenses/gpl-2.0.html

Expand Down Expand Up @@ -127,6 +127,16 @@ 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.5.1] - 2020-08-20 =

* Fixed: Avoid warnings regarding constants already defined;
* Fixed: Fixed the cache for the get_multiple_authors function for archive pages, #190;
* Fixed: Fixed fatal error Object of class WP_Error could not be converted to string, #182;
* Fixed: Fixed the value for $author->display_name which was returning the value from the user object instead of the custom value set for the author, #183;
* Fixed: Fixed Plugin::filter_user_has_cap() is passing a param to Util::get_current_post_type() which doesn't support params, #187;
* Fixed: Fixed Plugin::filter_user_has_cap() to use the correct user, not the current one, #186;
* Fixed: Removed leftovers from the deprecated capability: ppma_edit_orphan_post, #193;

= [3.5.0] - 2020-08-06 =

* Added: Added a new widget to display all the authors, #76;
Expand Down
1 change: 0 additions & 1 deletion src/core/Classes/Installer.php
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,6 @@ public static function add_author_term_for_posts()
private static function add_capabilities()
{
$role = get_role('administrator');
$role->add_cap('ppma_edit_orphan_post');
$role->add_cap('ppma_manage_authors');
$role->add_cap('manage_options');
}
Expand Down
53 changes: 44 additions & 9 deletions src/core/Classes/Legacy/Util.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,37 +15,72 @@ class Util
* Checks for the current post type
*
* @return string|null $post_type The post type we've found, or null if no post type
*
* @deprecated getCurrentPostType
*/
public static function get_current_post_type()
{
return static::getCurrentPostType();
}

/**
* Checks for the current post type
*
* @return string|null $post_type The post type we've found, or null if no post type
*/
public static function getCurrentPostType()
{
global $post, $typenow, $pagenow, $current_screen;

// get_post() needs a variable
$post_id = isset($_REQUEST['post']) ? (int)$_REQUEST['post'] : false;

$post_type = null;

if ($post && $post->post_type) {
$post_type = $post->post_type;
$post_type = static::getPostPostType($post);
} elseif ($typenow) {
$post_type = $typenow;
} elseif ($current_screen && !empty($current_screen->post_type)) {
$post_type = $current_screen->post_type;
} elseif (isset($_REQUEST['post_type'])) {
} elseif (isset($_REQUEST['post_type']) && !empty($_REQUEST['post_type'])) {
$post_type = sanitize_key($_REQUEST['post_type']);
} elseif ('post.php' == $pagenow
&& $post_id
&& !empty(get_post($post_id)->post_type)) {
$post_type = get_post($post_id)->post_type;
} elseif ('post.php' == $pagenow && !empty($post_id)) {
$post_type = static::getPostPostType($post_id);
} elseif ('edit.php' == $pagenow && empty($_REQUEST['post_type'])) {
$post_type = 'post';
} elseif (self::isAuthor()) {
$post_type = 'post';
} else {
$post_type = null;
}

return $post_type;
}

/**
* @param \WP_Post|int $postOrPostId
*
* @return string|false
*/
public static function getPostPostType($postOrPostId)
{
$post = null;

if (is_numeric($postOrPostId)) {
$postOrPostId = (int)$postOrPostId;

if (!empty($postOrPostId)) {
$post = get_post($postOrPostId);
}
} else {
$post = $postOrPostId;
}

if (!$post instanceof \WP_Post) {
return false;
}

return $post->post_type;
}

/**
* @return bool|void
*/
Expand Down
Loading

0 comments on commit 19ea5de

Please sign in to comment.