Skip to content

Commit 94a3c5c

Browse files
authored
Merge pull request #1106 from Automattic/release/3.6.4
Release/3.6.4
2 parents b816640 + e3dd71a commit 94a3c5c

12 files changed

+172
-64
lines changed

.github/workflows/deploy.yml

+6
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,12 @@ jobs:
1111
steps:
1212
- name: Checkout
1313
uses: actions/checkout@v4
14+
15+
- name: Install SVN (Subversion)
16+
run: |
17+
sudo apt-get update
18+
sudo apt-get install subversion
19+
1420
- name: Push to WordPress.org
1521
uses: 10up/action-wordpress-plugin-deploy@stable
1622
env:

.github/workflows/integrate.yml

+5
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,11 @@ jobs:
3636
- name: Checkout code
3737
uses: actions/checkout@v4
3838

39+
- name: Install SVN (Subversion)
40+
run: |
41+
sudo apt-get update
42+
sudo apt-get install subversion
43+
3944
- name: Set up PHP ${{ matrix.php }}
4045
uses: shivammathur/setup-php@v2
4146
with:

CHANGELOG.md

+10
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,15 @@ All notable changes to this project will be documented in this file.
55
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
66
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
77

8+
## [3.6.4] - 2025-03-24
9+
10+
### Fixed
11+
* Protect against duplicate authors being added to patterns and parent posts when a synced pattern is edited. #1103
12+
13+
### Maintenance
14+
* Increase composer/installers version #1104
15+
* Add SVN install to integrate workflow #1105
16+
817
## [3.6.3] - 2024-10-25
918

1019
### Fixed
@@ -514,6 +523,7 @@ Props to the many people who helped make this release possible: [catchmyfame](ht
514523
**1.1.0 (Apr. 14, 2009)**
515524
* Initial beta release.
516525

526+
[3.6.4]: https://github.com/automattic/co-authors-plus/compare/3.6.3...3.6.4
517527
[3.6.3]: https://github.com/automattic/co-authors-plus/compare/3.6.2...3.6.3
518528
[3.6.2]: https://github.com/automattic/co-authors-plus/compare/3.6.1...3.6.2
519529
[3.6.1]: https://github.com/automattic/co-authors-plus/compare/3.6.0...3.6.1

README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Co-Authors Plus
22

3-
Stable tag: 3.6.3
3+
Stable tag: 3.6.4
44
Requires at least: 5.9
55
Tested up to: 6.6
66
Requires PHP: 7.4

co-authors-plus.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
* Plugin Name: Co-Authors Plus
1212
* Plugin URI: https://wordpress.org/plugins/co-authors-plus/
1313
* Description: Allows multiple authors to be assigned to a post. This plugin is an extended version of the Co-Authors plugin developed by Weston Ruter.
14-
* Version: 3.6.3
14+
* Version: 3.6.4
1515
* Requires at least: 5.9
1616
* Requires PHP: 7.4
1717
* Author: Mohammad Jangda, Daniel Bachhuber, Automattic
@@ -21,7 +21,7 @@
2121
* License URI: http://www.gnu.org/licenses/gpl-2.0.txt
2222
*/
2323

24-
const COAUTHORS_PLUS_VERSION = '3.6.3';
24+
const COAUTHORS_PLUS_VERSION = '3.6.4';
2525
const COAUTHORS_PLUS_FILE = __FILE__;
2626

2727
require_once __DIR__ . '/template-tags.php';

composer.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
"forum": "https://wordpress.org/support/plugin/co-authors-plus"
2323
},
2424
"require": {
25-
"composer/installers": "~1.0",
25+
"composer/installers": "^2",
2626
"php": ">=7.4"
2727
},
2828
"require-dev": {

package-lock.json

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "co-authors-plus",
3-
"version": "3.6.3",
3+
"version": "3.6.4",
44
"description": "Allows multiple authors to be assigned to a post.",
55
"license": "GPL-2.0-or-later",
66
"private": true,

php/class-coauthors-endpoint.php

+33-1
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,9 @@ public function get_coauthors_search_results( $request ): WP_REST_Response {
152152
public function get_coauthors( $request ): WP_REST_Response {
153153
$response = array();
154154

155-
$this->_build_authors_response( $response, $request );
155+
if ( ! $this->request_is_for_wp_block_post_type( $request ) && ! $this->is_pattern_sync_operation() ) {
156+
$this->_build_authors_response( $response, $request );
157+
}
156158

157159
return rest_ensure_response( $response );
158160
}
@@ -233,6 +235,36 @@ public function _build_authors_response( &$response, $request ): void {
233235
}
234236
}
235237

238+
/**
239+
* Check if the request is for a wp_block post type.
240+
*
241+
* @param WP_REST_Request $request Request object.
242+
* @return bool
243+
*/
244+
private function request_is_for_wp_block_post_type( WP_REST_Request $request ): bool {
245+
return 'wp_block' === get_post_type( $request->get_param( 'post_id' ) );
246+
}
247+
248+
/**
249+
* Check if this is a pattern sync operation.
250+
*
251+
* @return bool
252+
*/
253+
private function is_pattern_sync_operation(): bool {
254+
$referer = wp_get_referer();
255+
if ( ! $referer ) {
256+
return false;
257+
}
258+
259+
$query_string = wp_parse_url( $referer, PHP_URL_QUERY );
260+
if ( ! $query_string ) {
261+
return false;
262+
}
263+
264+
parse_str( $query_string, $query_vars );
265+
return ! empty( $query_vars['post'] ) && 'wp_block' === get_post_type( $query_vars['post'] );
266+
}
267+
236268
/**
237269
* Add filters to REST endpoints for each post that
238270
* supports co-authors.

php/class-coauthors-plus.php

+26
Original file line numberDiff line numberDiff line change
@@ -243,6 +243,7 @@ public function admin_init(): void {
243243

244244
// Apply some targeted filters
245245
add_action( 'load-edit.php', array( $this, 'load_edit' ) );
246+
add_action( 'load-users.php', array( $this, 'load_users_screen' ) );
246247
}
247248

248249
/**
@@ -1509,6 +1510,31 @@ public function filter_views( $views ) {
15091510
return $views;
15101511
}
15111512

1513+
/**
1514+
* Prevent WordPress from counting users' posts for Users table column that
1515+
* is removed by the `_filter_manage_users_columns` method.
1516+
*
1517+
* @return void
1518+
*/
1519+
public function load_users_screen(): void {
1520+
add_filter( 'pre_count_many_users_posts', array( $this, 'bypass_user_post_count' ), 10, 2 );
1521+
}
1522+
1523+
/**
1524+
* Return empty counts for `count_users_many_posts()`, to bypass the heavy
1525+
* and unused query results.
1526+
*
1527+
* @param string[]|null $counts Post counts.
1528+
* @param array $user_ids User IDs to return counts for.
1529+
* @return array
1530+
*/
1531+
public function bypass_user_post_count( $counts, $user_ids ) {
1532+
return array_fill_keys(
1533+
array_map( 'absint', $user_ids ),
1534+
0
1535+
);
1536+
}
1537+
15121538
/**
15131539
* Adds necessary javascript variables to admin pages
15141540
*/

0 commit comments

Comments
 (0)