Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Release v4.7.4 #2000

Merged
merged 39 commits into from
Feb 20, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
39 commits
Select commit Hold shift + click to select a range
4f68bb2
Merge pull request #1965 from publishpress/master
ojopaul Dec 16, 2024
6103158
Authors FREE Translation Updates v.4.7.3 #1966
ojopaul Dec 18, 2024
b2d3ce5
Merge pull request #1967 from publishpress/update/#1966-Authors-FREE-…
ojopaul Dec 18, 2024
bed1fc8
PHP Warning with Rank Math #1970
ojopaul Feb 10, 2025
600ccb2
Merge pull request #1980 from publishpress/fix/#1970-PHP-Warning-with…
ojopaul Feb 10, 2025
cdf88cf
Update text for bulk edit #1978
ojopaul Feb 10, 2025
360a5da
Merge pull request #1981 from publishpress/update/#1978-Update-text-f…
ojopaul Feb 10, 2025
eca07d0
Update "Twitter" for "X" on new installation #1955
ojopaul Feb 10, 2025
875e390
Merge pull request #1982 from publishpress/Changes/#1955-Update-Twitt…
ojopaul Feb 10, 2025
3c41177
Fatal error: "Class "MultipleAuthors\WP_Error" not found" #1971
ojopaul Feb 10, 2025
1946f9e
Merge pull request #1983 from publishpress/fix/#1971-Fatal-error-Clas…
ojopaul Feb 10, 2025
68e86e3
Author Categories Errors on installs #1972
ojopaul Feb 10, 2025
b8b3120
Merge pull request #1984 from publishpress/fix/#1972-Author-Categorie…
ojopaul Feb 10, 2025
d3af0c8
Undefined property: WP_Error::$count #1974
ojopaul Feb 10, 2025
622d147
Merge pull request #1985 from publishpress/fix/#1974-Undefined-proper…
ojopaul Feb 10, 2025
5d4b6b3
Conflict between Polylang and Authors #1931
ojopaul Feb 11, 2025
85a685f
Merge pull request #1986 from publishpress/fix/#1931-Conflict-between…
ojopaul Feb 11, 2025
f7665c6
"Mine" not showing when author is a secondary author on posts #1939
ojopaul Feb 11, 2025
0b351e9
Merge pull request #1987 from publishpress/fix/#1939-Mine-not-showing…
ojopaul Feb 11, 2025
d0e7d0c
Admin "Mine" tab count is incorrect, and also including post from all…
ojopaul Feb 11, 2025
1f92c0f
Merge pull request #1990 from publishpress/fix/#1989-Admin-Mine-tab-c…
ojopaul Feb 11, 2025
85caca9
Add settings to show Author profile above the content #1929
ojopaul Feb 14, 2025
2bfb7ed
Merge pull request #1991 from publishpress/update/#1929-Add-settings-…
ojopaul Feb 14, 2025
424cbd5
Remove redundant repeated CSS and move Author box styling from conten…
ojopaul Feb 14, 2025
cd820e4
Merge pull request #1992 from publishpress/fix/#1976-Remove-redundant…
ojopaul Feb 14, 2025
4de1681
Text update
ojopaul Feb 14, 2025
f85c902
Merge pull request #1993 from publishpress/text-update
ojopaul Feb 14, 2025
a69a461
Allow Display Name Author Categories to be in front #1894
ojopaul Feb 14, 2025
374e670
Merge pull request #1994 from publishpress/update/#1894-Allow-Display…
ojopaul Feb 14, 2025
fe18237
Add sub headings to Author Boxes > Author Fields #1889
ojopaul Feb 14, 2025
7714c8a
Merge pull request #1995 from publishpress/update/#1889-Add-sub-headi…
ojopaul Feb 14, 2025
3d51c1c
Fix data sanitization on author categories
andergmartins Feb 14, 2025
2665bce
Merge pull request #1996 from publishpress/fix/orderby-data-sanitization
ojopaul Feb 20, 2025
5cbeb19
PHP Fatal error: Uncaught Error: Call to a member function get_user_o…
ojopaul Feb 20, 2025
d2ae379
Merge pull request #1998 from publishpress/fix/#1997-PHP-Fatal-error-…
ojopaul Feb 20, 2025
28c66d5
Update translation
ojopaul Feb 20, 2025
33d4152
Update version
ojopaul Feb 20, 2025
f995e2f
Update changelog
ojopaul Feb 20, 2025
7bde475
Composer update
ojopaul Feb 20, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
317 changes: 160 additions & 157 deletions composer.lock

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion defines.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
defined('ABSPATH') or die('No direct script access allowed.');

if (!defined('PP_AUTHORS_LOADED')) {
define('PP_AUTHORS_VERSION', '4.7.3');
define('PP_AUTHORS_VERSION', '4.7.4');
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/');
Expand Down
Binary file modified languages/publishpress-authors-es_ES.mo
Binary file not shown.
964 changes: 503 additions & 461 deletions languages/publishpress-authors-es_ES.po

Large diffs are not rendered by default.

Binary file modified languages/publishpress-authors-fr_FR.mo
Binary file not shown.
964 changes: 503 additions & 461 deletions languages/publishpress-authors-fr_FR.po

Large diffs are not rendered by default.

Binary file modified languages/publishpress-authors-it_IT.mo
Binary file not shown.
964 changes: 503 additions & 461 deletions languages/publishpress-authors-it_IT.po

Large diffs are not rendered by default.

1,763 changes: 936 additions & 827 deletions languages/publishpress-authors.pot

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion publishpress-authors.php
Original file line number Diff line number Diff line change
Expand Up @@ -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: 4.7.3
* Version: 4.7.4
* Text Domain: publishpress-authors
* Domain Path: /languages
* Requires at least: 5.5
Expand Down
27 changes: 24 additions & 3 deletions readme.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ Tags: multiple authors, authors, guest authors, author bio, author layouts
Requires at least: 5.5
Requires PHP: 7.2.5
Tested up to: 6.7
Stable tag: 4.7.3
Stable tag: 4.7.4
License: GPLv2 or later
License URI: http://www.gnu.org/licenses/gpl-2.0.html

Expand Down Expand Up @@ -105,7 +105,7 @@ PublishPress Authors Pro enables you to create author fields and enhance your au

The Pro versions of the PublishPress plugins are well worth your investment. The Pro versions have extra features and faster support. [Click here to join PublishPress](https://publishpress.com/pricing/).

Join PublishPress and you'll get access to these Pro plugins:
Join PublishPress and you'll get access to these ten Pro plugins:

* [PublishPress Authors Pro](https://publishpress.com/authors) allows you to add multiple authors and guest authors to WordPress posts.
* [PublishPress Blocks Pro](https://publishpress.com/blocks) has everything you need to build professional websites with the WordPress block editor.
Expand All @@ -115,7 +115,8 @@ Join PublishPress and you'll get access to these Pro plugins:
* [PublishPress Permissions Pro](https://publishpress.com/permissions) is the plugin for advanced WordPress permissions.
* [PublishPress Planner Pro](https://publishpress.com/publishpress) is the plugin for managing and scheduling WordPress content.
* [PublishPress Revisions Pro](https://publishpress.com/revisions) allows you to update your published pages with teamwork and precision.
* [PublishPress Series Pro](https://publishpress.com/series) enables you to group content together into a series
* [PublishPress Series Pro](https://publishpress.com/series) enables you to group content together into a series.
* [PublishPress Statuses Pro](https://publishpress.com/series) enables you to create additional publishing steps for your posts.

Together, these plugins are a suite of powerful publishing tools for WordPress. If you need to create a professional workflow in WordPress, with moderation, revisions, permissions and more... then you should try PublishPress.

Expand Down Expand Up @@ -246,6 +247,26 @@ There are two ways to install the PublishPress Authors plugin:

== Changelog ==

= [4.7.4] - 20 Feb 2025 =

* Fixed: Fix data sanitization on author categories
* Fixed: PHP Warning with Rank Math, #1970
* Fixed: Conflict between Polylang and Authors, #1931
* Update: Add sub headings to Author Boxes > Author Fields, #1889
* Update: Allow Display Name Author Categories to be in front, #1894
* Fixed: PHP Fatal error: Uncaught Error: Call to a member function get_user_object() on bool, #1997
* Update: Add settings to show Author profile above the content, #1929
* Fixed: Post Filter Not Working when filtering on Author and Category together, #1933
* Fixed: Admin "Mine" tab count is incorrect, and also including post from all post types instead of current post type, #1989
* Fixed: "Mine" not showing when author is a secondary author on posts, #1939
* Fixed: Undefined property: WP_Error::$count, #1974
* Fixed: Author Categories Errors on installs, #1972
* Fixed: Redundant repeated CSS and move Author box styling from content to footer(filtereable), #1976
* Fixed: Fatal error: "Class "MultipleAuthors\WP_Error" not found", #1971
* Update: Update "Twitter" for "X" on new installation, #1955
* Update: Update text for bulk edit, #1978
* Update: Authors Translation Updates v.4.7.3, #1966

= [4.7.3] - 16 Dec 2024 =

* Fixed: Can't change the layout for new Author Lists, #1892
Expand Down
4 changes: 3 additions & 1 deletion src/assets/css/multiple-authors-widget.css
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,9 @@
}

.pp-multiple-authors-layout-boxed .multiple-authors-name a,
.pp-multiple-authors-layout-centered .multiple-authors-name a {
.pp-multiple-authors-layout-centered .multiple-authors-name a,
.pp-multiple-authors-layout-boxed .name-author-category,
.pp-multiple-authors-layout-centered .name-author-category {
margin-bottom: 10px;
font-size: 1.2em;
}
Expand Down
2 changes: 1 addition & 1 deletion src/core/Classes/Author_Editor.php
Original file line number Diff line number Diff line change
Expand Up @@ -836,7 +836,7 @@ public static function filter_author_bulk_actions($bulk_actions)
'publishpress-authors'
);
$bulk_actions['convert_into_guest_author'] = __(
'Convert to Registered Author With User Account',
'Convert to Guest Author With User Account',
'publishpress-authors'
);
$bulk_actions['update_post_count'] = __(
Expand Down
2 changes: 1 addition & 1 deletion src/core/Classes/Post_Editor.php
Original file line number Diff line number Diff line change
Expand Up @@ -302,7 +302,7 @@ public static function group_category_authors($author_categories, $author_relati
$authors_data[] = [
'title' => $author_category['plural_name'],
'singular_title' => $author_category['category_name'],
'description' => sprintf('Drag-and-drop Authors to add them to the %s category', $author_category['category_name']),
'description' => sprintf(esc_html__('Drag-and-drop Authors to add them to the %s category', 'publishpress-authors'), $author_category['category_name']),
'slug' => $author_category['slug'],
'id' => $author_category['id'],
'authors' => array_values($selected_authors)
Expand Down
26 changes: 15 additions & 11 deletions src/core/Classes/Query.php
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,7 @@ public static function filter_author_posts_where($where, $query)
}
$where = preg_replace(
'/\(?\b(?:' . $wpdb->posts . '\.)?post_author\s*(?:=|IN)\s*\(?(\d+)\)? AND (?:' . $wpdb->posts . '\.)?post_status = \'(\w+)\'/',
'(' . $maybe_both_query . ' ' . $wpdb->term_taxonomy . '.term_id = \'' . (int)$current_user_term_id . '\' AND ' . $wpdb->posts . '.post_status = \'$2\'',
'(' . $maybe_both_query . ' ' . 'ppmaq1.term_taxonomy_id IN (' . (int)$current_user_term_id . ') AND ' . $wpdb->posts . '.post_status = \'$2\'',
$where,
-1
);
Expand All @@ -221,12 +221,15 @@ public static function filter_author_posts_where($where, $query)
*/
$where = preg_replace(
'/\(?\b(?:' . $wpdb->posts . '\.)?post_author\s*(?:=|IN)\s*\(?(\d+)\)?/',
'(' . $maybe_both_query . ' ' . '(' . $wpdb->term_taxonomy . '.term_id = \'' . (int)$term->term_id . '\') ' . ')',
'(' . $maybe_both_query . ' ' . '(ppmaq1.term_taxonomy_id IN (' . (int)$term->term_id . ')) ' . ')',
$where,
-1
);

$where = static::add_custom_post_types_to_query($where);

// Add post type only if it's not an admin main query
if ( ! ( is_admin() && $query->is_main_query() ) ) {
$where = static::add_custom_post_types_to_query($where);
}

return apply_filters('publishpress_authors_filter_posts_list_where', $where, $query, $term);
}
Expand All @@ -249,8 +252,8 @@ public static function filter_posts_join($join, $query)

// Check to see that JOIN hasn't already been added. Props michaelingp and nbaxley.
$term_relationship_inner_join = " INNER JOIN {$wpdb->term_relationships} ON ({$wpdb->posts}.ID = {$wpdb->term_relationships}.object_id)";
$term_relationship_left_join = " LEFT JOIN {$wpdb->term_relationships} ON ({$wpdb->posts}.ID = {$wpdb->term_relationships}.object_id)";
$term_taxonomy_join = " INNER JOIN {$wpdb->term_taxonomy} ON ( {$wpdb->term_relationships}.term_taxonomy_id = {$wpdb->term_taxonomy}.term_taxonomy_id )";
$term_relationship_left_join = " LEFT JOIN {$wpdb->term_relationships} AS ppmaq1 ON ({$wpdb->posts}.ID = ppmaq1.object_id)";
$term_taxonomy_join = " INNER JOIN {$wpdb->term_taxonomy} ON ( ppmaq1.term_taxonomy_id = {$wpdb->term_taxonomy}.term_taxonomy_id )";

// 4.6+ uses a LEFT JOIN for tax queries so we need to check for both.
if (false === strpos($join, trim($term_relationship_inner_join))
Expand All @@ -259,7 +262,7 @@ public static function filter_posts_join($join, $query)
}

if (false === strpos($join, trim($term_taxonomy_join))) {
$join .= str_replace('INNER JOIN', 'LEFT JOIN', $term_taxonomy_join);
$join .= str_replace('INNER JOIN', 'LEFT JOIN', $term_taxonomy_join);
}

return $join;
Expand Down Expand Up @@ -330,7 +333,7 @@ public static function filter_admin_posts_list_where($where, $query)
return $where;
}

$terms_implode = '(' . $wpdb->term_taxonomy . '.term_id = \'' . (int)$author->getTerm()->term_id . '\') ';
$terms_implode = '(' . 'ppmaq1.term_taxonomy_id IN (' . (int)$author->getTerm()->term_id . ')) ';

/**
* Regex for Post Author + Post Status solution for private and custom post status
Expand All @@ -348,9 +351,10 @@ public static function filter_admin_posts_list_where($where, $query)
} else {
$current_user_term_id = 0;
}

$where = preg_replace(
'/\(?\b(?:' . $wpdb->posts . '\.)?post_author\s*(?:=|IN)\s*\(?(\d+)\)? AND (?:' . $wpdb->posts . '\.)?post_status = \'(\w+)\'/',
'(' . $wpdb->term_taxonomy . '.term_id = \'' . (int)$current_user_term_id . '\' AND ' . $wpdb->posts . '.post_status = \'$2\'',
'(' . 'ppmaq1.term_taxonomy_id IN (' . (int)$current_user_term_id . ') AND ' . $wpdb->posts . '.post_status = \'$2\'',
$where,
-1
);
Expand Down Expand Up @@ -451,8 +455,8 @@ public static function filter_posts_list_join($join, $query)

// Check to see that JOIN hasn't already been added. Props michaelingp and nbaxley.
$term_relationship_inner_join = " INNER JOIN {$wpdb->term_relationships} ON ({$wpdb->posts}.ID = {$wpdb->term_relationships}.object_id)";
$term_relationship_left_join = " LEFT JOIN {$wpdb->term_relationships} ON ({$wpdb->posts}.ID = {$wpdb->term_relationships}.object_id)";
$term_taxonomy_join = " INNER JOIN {$wpdb->term_taxonomy} ON ( {$wpdb->term_relationships}.term_taxonomy_id = {$wpdb->term_taxonomy}.term_taxonomy_id )";
$term_relationship_left_join = " LEFT JOIN {$wpdb->term_relationships} AS ppmaq1 ON ({$wpdb->posts}.ID = ppmaq1.object_id)";
$term_taxonomy_join = " INNER JOIN {$wpdb->term_taxonomy} ON ( ppmaq1.term_taxonomy_id = {$wpdb->term_taxonomy}.term_taxonomy_id )";

// 4.6+ uses a LEFT JOIN for tax queries so we need to check for both.
if (false === strpos($join, trim($term_relationship_inner_join))
Expand Down
30 changes: 23 additions & 7 deletions src/core/Plugin.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
use MultipleAuthors\Classes\Utils;
use MultipleAuthors\Traits\Author_box;
use WP_Query;
use WP_Error;

defined('ABSPATH') or die('No direct script access allowed.');

Expand Down Expand Up @@ -1146,7 +1147,14 @@ public function filter_count_author_posts($count, $author)
return 0;
}

return $author->getTerm()->count;
$term = $author->getTerm();

// Ensure $term is a valid object before accessing properties incase of legacy data
if (!is_object($term) || is_wp_error($term)) {
return 0;
}

return $term->count ?? 0;
}

/**
Expand Down Expand Up @@ -1491,7 +1499,7 @@ public function enqueue_scripts($hook_suffix)
$js_strings = [
'edit_label' => esc_html__('Edit', 'publishpress-authors'),
'new_button' => esc_html__('Add Author', 'publishpress-authors'),
'new_name_label' => esc_html__('Author Name'),
'new_name_label' => esc_html__('Author Name', 'publishpress-authors'),
'confirm_delete' => __(
'Are you sure you want to remove this author?',
'publishpress-authors'
Expand Down Expand Up @@ -1612,7 +1620,7 @@ public function filter_views($views)
}

$author = Author::get_by_user_id(get_current_user_id());
if (!$author || !is_object(!$author)) {
if (!$author || !is_object($author)) {
return $default_views;
}

Expand Down Expand Up @@ -1804,11 +1812,19 @@ public function filter_the_content($content)
{
$legacyPlugin = Factory::getLegacyPlugin();

// Check if it is configured to append to the content
$append_to_content = 'yes' === $legacyPlugin->modules->multiple_authors->options->append_to_content;
if ($this->should_display_author_box()) {

if ($this->should_display_author_box() && $append_to_content) {
$content .= $this->get_author_box_markup('the_content');
// Check if it is configured to prepend and/or append to the content
$preppend_to_content = 'yes' === $legacyPlugin->modules->multiple_authors->options->preppend_to_content;
$append_to_content = 'yes' === $legacyPlugin->modules->multiple_authors->options->append_to_content;

if ($preppend_to_content) {
$content = $this->get_author_box_markup('the_content') . $content;
}

if ($append_to_content) {
$content .= $this->get_author_box_markup('the_content');
}
}

return $content;
Expand Down
22 changes: 17 additions & 5 deletions src/functions/template-tags.php
Original file line number Diff line number Diff line change
Expand Up @@ -428,6 +428,13 @@ function publishpress_authors_get_all_authors($args = [], $instance = [])
*/
$args = apply_filters('pp_multiple_authors_get_all_authors_args', $args, $instance);

$args['orderby'] = sanitize_sql_orderby($args['orderby'] ?? 'name');
if (empty($args['orderby'])) {
$args['orderby'] = 'name';
}

$args['order'] = strtoupper($args['order'] ?? 'ASC') === 'DESC' ? 'DESC' : 'ASC';

if (!empty($args['orderby']) && !in_array($args['orderby'], ['name', 'count'])) {
$meta_order = true;
} else {
Expand Down Expand Up @@ -566,7 +573,9 @@ function publishpress_authors_get_all_authors($args = [], $instance = [])
} else {
$sql_order_by = "tm.meta_value";
}
$term_query .= "ORDER BY {$sql_order_by} {$args['order']}";
$sql_order_by = $sql_order_by . ' ' . $args['order'];

$term_query .= "ORDER BY {$sql_order_by}";
//add limit if it's a paginated request
if ($paged) {
$term_query .= " LIMIT {$offset}, {$per_page}";
Expand Down Expand Up @@ -1484,12 +1493,15 @@ function get_ppma_author_categories($args = []) {
$slug = sanitize_text_field($args['slug']);
$category_name = sanitize_text_field($args['category_name']);
$plural_name = sanitize_text_field($args['plural_name']);
$orderby = sanitize_text_field($args['orderby']);
$search = sanitize_text_field($args['search']);
$order = strtoupper(sanitize_text_field($args['order']));
$orderby = sanitize_sql_orderby($args['orderby'] . ' ' . strtoupper($args['order']));
$category_status = sanitize_text_field($args['category_status']);
$count_only = boolval($args['count_only']);

if (empty($orderby)) {
$orderby = 'category_order ASC';
}

$field_search = $field_value = false;
if (!empty($id)) {
$field_search = 'id';
Expand Down Expand Up @@ -1517,7 +1529,7 @@ function get_ppma_author_categories($args = []) {
FROM {$table_name}
LEFT JOIN {$meta_table_name} ON {$table_name}.id = {$meta_table_name}.category_id
WHERE {$table_name}.{$field_search} = %s
ORDER BY {$orderby} {$order}
ORDER BY {$orderby}
LIMIT 1",
$field_value
);
Expand Down Expand Up @@ -1558,7 +1570,7 @@ function get_ppma_author_categories($args = []) {
}

$query .= $wpdb->prepare(
" ORDER BY {$orderby} {$order} LIMIT %d OFFSET %d",
" ORDER BY {$orderby} LIMIT %d OFFSET %d",
$limit,
$offset
);
Expand Down
Loading
Loading