Co-Authors Plus - Version 3.4.4

Version Description

  • Fixed bug where author with slug beginning with "cap" does not appear in bylines AJAX suggest box when queried
  • Travis for Xenial build no longer fails
  • Unit tests no longer fail
  • Fixed REST permissions bug where co-author cannot view post assigned to them in Gutenberg
Download this release

Release Info

Developer automattic
Plugin Icon wp plugin Co-Authors Plus
Version 3.4.4
Comparing to
See all releases

Code changes from version 3.4.3 to 3.4.4

.travis.yml CHANGED
@@ -1,10 +1,11 @@
1
  language: php
 
2
 
3
  matrix:
4
  include:
5
  # aliased to a recent 5.6.x version
6
  - php: "5.6"
7
- env: WP_VERSION=5.1.1
8
 
9
  - php: '5.6'
10
  env:
@@ -20,13 +21,13 @@ matrix:
20
 
21
  # aliased to a recent 7.x version
22
  - php: '7.0'
23
- env: WP_VERSION=5.1.1
24
 
25
  - php: '7.0'
26
  env: WP_VERSION=latest
27
 
28
  - php: '7.1'
29
- env: WP_VERSION=5.1.1
30
 
31
  - php: '7.1'
32
  env: WP_VERSION=latest
@@ -39,6 +40,8 @@ before_script:
39
  - if [[ "$SNIFF" == "1" ]]; then git clone -b master --depth 1 https://github.com/squizlabs/PHP_CodeSniffer.git $PHPCS_DIR; fi
40
  # Install WordPress Coding Standards.
41
  - if [[ "$SNIFF" == "1" ]]; then git clone -b master --depth 1 https://github.com/WordPress-Coding-Standards/WordPress-Coding-Standards.git $SNIFFS_DIR; fi
 
 
42
  # Install PHP Compatibility sniffs.
43
  - if [[ "$SNIFF" == "1" ]]; then git clone -b master --depth 1 https://github.com/wimg/PHPCompatibility.git $SNIFFS_DIR/PHPCompatibility; fi
44
  # Set install path for PHPCS sniffs.
@@ -48,24 +51,10 @@ before_script:
48
  - if [[ "$SNIFF" == "1" ]]; then phpenv rehash; fi
49
  # Set up unit tests
50
  - bash bin/install-wp-tests.sh wordpress_test root '' localhost $WP_VERSION
51
- # Properly handle PHPUnit versions
52
- - export PATH="$HOME/.composer/vendor/bin:$PATH"
53
- - |
54
- if [[ ${TRAVIS_PHP_VERSION:0:3} == "5.6" ]]; then
55
- composer global require "phpunit/phpunit=4.8.*"
56
- elif [[ ${TRAVIS_PHP_VERSION:0:2} == "7." && ${WP_VERSION} == "5.1.1" ]]; then
57
- composer global require "phpunit/phpunit=5.7.*"
58
- fi
59
- - |
60
- if [[ -n $COMPOSER_BIN_DIR && -x $COMPOSER_BIN_DIR/phpunit ]]; then
61
- $COMPOSER_BIN_DIR/phpunit --version
62
- else
63
- phpunit --version
64
- fi
65
 
66
  script:
67
- # Search for PHP syntax errors.
68
- - find -L . -name '*.php' -print0 | xargs -0 -n 1 -P 4 php -l
69
  # WordPress Coding Standards.
70
  # @link https://github.com/WordPress-Coding-Standards/WordPress-Coding-Standards
71
  # @link http://pear.php.net/package/PHP_CodeSniffer/
@@ -75,11 +64,6 @@ script:
75
  # -n flag: Do not print warnings. (shortcut for --warning-severity=0)
76
  # --standard: Use WordPress as the standard.
77
  # --extensions: Only sniff PHP files.
78
- - if [[ "$SNIFF" == "1" ]]; then $PHPCS_DIR/scripts/phpcs -p -s -v -n . --standard="WordPress-VIP" --extensions=php; fi
79
  # Run unit tests
80
- - |
81
- if [[ -n $COMPOSER_BIN_DIR && -x $COMPOSER_BIN_DIR/phpunit ]]; then
82
- $COMPOSER_BIN_DIR/phpunit
83
- else
84
- phpunit
85
- fi
1
  language: php
2
+ services: mysql
3
 
4
  matrix:
5
  include:
6
  # aliased to a recent 5.6.x version
7
  - php: "5.6"
8
+ env: WP_VERSION=5.6.1
9
 
10
  - php: '5.6'
11
  env:
21
 
22
  # aliased to a recent 7.x version
23
  - php: '7.0'
24
+ env: WP_VERSION=5.6.1
25
 
26
  - php: '7.0'
27
  env: WP_VERSION=latest
28
 
29
  - php: '7.1'
30
+ env: WP_VERSION=5.6.1
31
 
32
  - php: '7.1'
33
  env: WP_VERSION=latest
40
  - if [[ "$SNIFF" == "1" ]]; then git clone -b master --depth 1 https://github.com/squizlabs/PHP_CodeSniffer.git $PHPCS_DIR; fi
41
  # Install WordPress Coding Standards.
42
  - if [[ "$SNIFF" == "1" ]]; then git clone -b master --depth 1 https://github.com/WordPress-Coding-Standards/WordPress-Coding-Standards.git $SNIFFS_DIR; fi
43
+ # Install VIP Coding Standards.
44
+ - if [[ "$SNIFF" == "1" ]]; then git clone -b master --depth 1 https://github.com/Automattic/VIP-Coding-Standards.git $SNIFFS_DIR; fi
45
  # Install PHP Compatibility sniffs.
46
  - if [[ "$SNIFF" == "1" ]]; then git clone -b master --depth 1 https://github.com/wimg/PHPCompatibility.git $SNIFFS_DIR/PHPCompatibility; fi
47
  # Set install path for PHPCS sniffs.
51
  - if [[ "$SNIFF" == "1" ]]; then phpenv rehash; fi
52
  # Set up unit tests
53
  - bash bin/install-wp-tests.sh wordpress_test root '' localhost $WP_VERSION
54
+ # Properly handle versions since the pre-installed PHPUnit is incompatible on some builds
55
+ - composer require --dev "phpunit/phpunit":"^5"
 
 
 
 
 
 
 
 
 
 
 
 
56
 
57
  script:
 
 
58
  # WordPress Coding Standards.
59
  # @link https://github.com/WordPress-Coding-Standards/WordPress-Coding-Standards
60
  # @link http://pear.php.net/package/PHP_CodeSniffer/
64
  # -n flag: Do not print warnings. (shortcut for --warning-severity=0)
65
  # --standard: Use WordPress as the standard.
66
  # --extensions: Only sniff PHP files.
67
+ - if [[ "$SNIFF" == "1" ]]; then $PHPCS_DIR/scripts/phpcs -p -s -v -n . --standard="WordPress-VIP-Go" --extensions=php; fi
68
  # Run unit tests
69
+ - ./vendor/bin/phpunit
 
 
 
 
 
README.md CHANGED
@@ -2,9 +2,9 @@
2
 
3
  * Contributors: batmoo, danielbachhuber, automattic
4
  * Tags: authors, users, multiple authors, co-authors, multi-author, publishing
5
- * Tested up to: 5.4
6
  * Requires at least: 4.1
7
- * Stable tag: 3.4.3
8
 
9
  Assign multiple bylines to posts, pages, and custom post types via a search-as-you-type input box
10
 
@@ -71,6 +71,12 @@ add_filter( 'coauthors_count_published_post_types', function( $post_types ) {
71
 
72
  ## Changelog ##
73
 
 
 
 
 
 
 
74
  **3.4.3**
75
  * Added author support to CPT instructions in readme FAQ #720
76
  * Added object check for user in `coauthors_set_post_author_field()` #721
2
 
3
  * Contributors: batmoo, danielbachhuber, automattic
4
  * Tags: authors, users, multiple authors, co-authors, multi-author, publishing
5
+ * Tested up to: 5.7
6
  * Requires at least: 4.1
7
+ * Stable tag: 3.4.4
8
 
9
  Assign multiple bylines to posts, pages, and custom post types via a search-as-you-type input box
10
 
71
 
72
  ## Changelog ##
73
 
74
+ **3.4.4**
75
+ * Fixed bug where author with slug beginning with "cap" does not appear in bylines AJAX suggest box when queried #744
76
+ * Travis for Xenial build no longer fails #751
77
+ * Unit tests no longer fail #752
78
+ * Fixed REST permissions bug where co-author cannot view post assigned to them in Gutenberg #757
79
+
80
  **3.4.3**
81
  * Added author support to CPT instructions in readme FAQ #720
82
  * Added object check for user in `coauthors_set_post_author_field()` #721
co-authors-plus.php CHANGED
@@ -3,7 +3,7 @@
3
  Plugin Name: Co-Authors Plus
4
  Plugin URI: http://wordpress.org/extend/plugins/co-authors-plus/
5
  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.
6
- Version: 3.4.3
7
  Author: Mohammad Jangda, Daniel Bachhuber, Automattic
8
  Copyright: 2008-2015 Shared and distributed between Mohammad Jangda, Daniel Bachhuber, Weston Ruter
9
 
@@ -32,7 +32,7 @@ Co-author - in the context of a single post, a guest author or user assigned to
32
  Author - user with the role of author
33
  */
34
 
35
- define( 'COAUTHORS_PLUS_VERSION', '3.4.3' );
36
 
37
  require_once( dirname( __FILE__ ) . '/template-tags.php' );
38
  require_once( dirname( __FILE__ ) . '/deprecated.php' );
@@ -1258,7 +1258,7 @@ class CoAuthors_Plus {
1258
  // Get the guest author objects
1259
  $found_users = array();
1260
  foreach ( $found_terms as $found_term ) {
1261
- $found_user = $this->get_coauthor_by( 'user_nicename', $found_term->slug );
1262
  if ( ! empty( $found_user ) ) {
1263
  $found_users[ $found_user->user_login ] = $found_user;
1264
  }
@@ -1406,12 +1406,14 @@ class CoAuthors_Plus {
1406
  public function get_to_be_filtered_caps() {
1407
  if( ! empty( $this->supported_post_types ) && empty( $this->to_be_filtered_caps ) ) {
1408
  $this->to_be_filtered_caps[] = 'edit_post'; // Need to filter this too, unfortunately: http://core.trac.wordpress.org/ticket/22415
 
1409
 
1410
  foreach( $this->supported_post_types as $single ) {
1411
  $obj = get_post_type_object( $single );
1412
 
1413
  $this->to_be_filtered_caps[] = $obj->cap->edit_post;
1414
  $this->to_be_filtered_caps[] = $obj->cap->edit_others_posts; // This as well: http://core.trac.wordpress.org/ticket/22417
 
1415
  }
1416
 
1417
  $this->to_be_filtered_caps = array_unique( $this->to_be_filtered_caps );
@@ -1443,6 +1445,8 @@ class CoAuthors_Plus {
1443
  $obj->cap->edit_post,
1444
  'edit_post', // Need to filter this too, unfortunately: http://core.trac.wordpress.org/ticket/22415
1445
  $obj->cap->edit_others_posts, // This as well: http://core.trac.wordpress.org/ticket/22417
 
 
1446
  );
1447
  if ( ! in_array( $cap, $caps_to_modify ) ) {
1448
  return $allcaps;
3
  Plugin Name: Co-Authors Plus
4
  Plugin URI: http://wordpress.org/extend/plugins/co-authors-plus/
5
  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.
6
+ Version: 3.4.4
7
  Author: Mohammad Jangda, Daniel Bachhuber, Automattic
8
  Copyright: 2008-2015 Shared and distributed between Mohammad Jangda, Daniel Bachhuber, Weston Ruter
9
 
32
  Author - user with the role of author
33
  */
34
 
35
+ define( 'COAUTHORS_PLUS_VERSION', '3.4.4' );
36
 
37
  require_once( dirname( __FILE__ ) . '/template-tags.php' );
38
  require_once( dirname( __FILE__ ) . '/deprecated.php' );
1258
  // Get the guest author objects
1259
  $found_users = array();
1260
  foreach ( $found_terms as $found_term ) {
1261
+ $found_user = $this->get_coauthor_by( 'user_nicename', $found_term->name );
1262
  if ( ! empty( $found_user ) ) {
1263
  $found_users[ $found_user->user_login ] = $found_user;
1264
  }
1406
  public function get_to_be_filtered_caps() {
1407
  if( ! empty( $this->supported_post_types ) && empty( $this->to_be_filtered_caps ) ) {
1408
  $this->to_be_filtered_caps[] = 'edit_post'; // Need to filter this too, unfortunately: http://core.trac.wordpress.org/ticket/22415
1409
+ $this->to_be_filtered_caps[] = 'read_post';
1410
 
1411
  foreach( $this->supported_post_types as $single ) {
1412
  $obj = get_post_type_object( $single );
1413
 
1414
  $this->to_be_filtered_caps[] = $obj->cap->edit_post;
1415
  $this->to_be_filtered_caps[] = $obj->cap->edit_others_posts; // This as well: http://core.trac.wordpress.org/ticket/22417
1416
+ $this->to_be_filtered_caps[] = $obj->cap->read_post;
1417
  }
1418
 
1419
  $this->to_be_filtered_caps = array_unique( $this->to_be_filtered_caps );
1445
  $obj->cap->edit_post,
1446
  'edit_post', // Need to filter this too, unfortunately: http://core.trac.wordpress.org/ticket/22415
1447
  $obj->cap->edit_others_posts, // This as well: http://core.trac.wordpress.org/ticket/22417
1448
+ 'read_post',
1449
+ $obj->cap->read_post,
1450
  );
1451
  if ( ! in_array( $cap, $caps_to_modify ) ) {
1452
  return $allcaps;
readme.txt CHANGED
@@ -1,9 +1,9 @@
1
  === Co-Authors Plus ===
2
  Contributors: batmoo, danielbachhuber, automattic
3
  Tags: authors, users, multiple authors, coauthors, multi-author, publishing
4
- Tested up to: 5.3.1
5
  Requires at least: 4.1
6
- Stable tag: 3.4.3
7
 
8
  Assign multiple bylines to posts, pages, and custom post types via a search-as-you-type input box
9
 
@@ -62,6 +62,12 @@ Bug fixes and minor enhancements
62
 
63
  == Changelog ==
64
 
 
 
 
 
 
 
65
  = 3.4.3 =
66
  * Added author support to CPT instructions in readme FAQ
67
  * Added object check for user in `coauthors_set_post_author_field()`
1
  === Co-Authors Plus ===
2
  Contributors: batmoo, danielbachhuber, automattic
3
  Tags: authors, users, multiple authors, coauthors, multi-author, publishing
4
+ Tested up to: 5.7
5
  Requires at least: 4.1
6
+ Stable tag: 3.4.4
7
 
8
  Assign multiple bylines to posts, pages, and custom post types via a search-as-you-type input box
9
 
62
 
63
  == Changelog ==
64
 
65
+ = 3.4.4 =
66
+ * Fixed bug where author with slug beginning with "cap" does not appear in bylines AJAX suggest box when queried
67
+ * Travis for Xenial build no longer fails
68
+ * Unit tests no longer fail
69
+ * Fixed REST permissions bug where co-author cannot view post assigned to them in Gutenberg
70
+
71
  = 3.4.3 =
72
  * Added author support to CPT instructions in readme FAQ
73
  * Added object check for user in `coauthors_set_post_author_field()`
tests/test-coauthors-plus.php CHANGED
@@ -361,7 +361,8 @@ class Test_CoAuthors_Plus extends CoAuthorsPlus_TestCase {
361
 
362
  // Checks when search term is empty and any subscriber exists.
363
  $subscriber1 = $this->factory->user->create_and_get( array(
364
- 'role' => 'subscriber',
 
365
  ) );
366
 
367
  $authors = $coauthors_plus->search_authors();
@@ -371,7 +372,8 @@ class Test_CoAuthors_Plus extends CoAuthorsPlus_TestCase {
371
 
372
  // Checks when search term is empty and any contributor exists.
373
  $contributor1 = $this->factory->user->create_and_get( array(
374
- 'role' => 'contributor',
 
375
  ) );
376
 
377
  $authors = $coauthors_plus->search_authors();
@@ -451,7 +453,8 @@ class Test_CoAuthors_Plus extends CoAuthorsPlus_TestCase {
451
 
452
  // Checks when ignoring author1 but also exists one more author with similar kind of data.
453
  $author2 = $this->factory->user->create_and_get( array(
454
- 'role' => 'author',
 
455
  ) );
456
 
457
  $authors = $coauthors_plus->search_authors( '', $ignored_authors );
361
 
362
  // Checks when search term is empty and any subscriber exists.
363
  $subscriber1 = $this->factory->user->create_and_get( array(
364
+ 'role' => 'subscriber',
365
+ 'user_login' => 'subscriber1'
366
  ) );
367
 
368
  $authors = $coauthors_plus->search_authors();
372
 
373
  // Checks when search term is empty and any contributor exists.
374
  $contributor1 = $this->factory->user->create_and_get( array(
375
+ 'role' => 'contributor',
376
+ 'user_login' => 'contributor1'
377
  ) );
378
 
379
  $authors = $coauthors_plus->search_authors();
453
 
454
  // Checks when ignoring author1 but also exists one more author with similar kind of data.
455
  $author2 = $this->factory->user->create_and_get( array(
456
+ 'role' => 'author',
457
+ 'user_login' => 'author2'
458
  ) );
459
 
460
  $authors = $coauthors_plus->search_authors( '', $ignored_authors );
tests/test-template-tags.php CHANGED
@@ -988,7 +988,7 @@ class Test_Template_Tags extends CoAuthorsPlus_TestCase {
988
  public function test_coauthors_get_avatar_default() {
989
 
990
  $this->assertEmpty( coauthors_get_avatar( $this->author1->ID ) );
991
- $this->assertEquals( preg_match( "|^<img alt='[^']*' src='[^']*' srcset='[^']*' class='[^']*' height='[^']*' width='[^']*' />$|", coauthors_get_avatar( $this->author1 ) ), 1 );
992
  }
993
 
994
  /**
@@ -1007,7 +1007,7 @@ class Test_Template_Tags extends CoAuthorsPlus_TestCase {
1007
 
1008
  $guest_author = $coauthors_plus->guest_authors->get_guest_author_by( 'id', $guest_author_id );
1009
 
1010
- $this->assertEquals( preg_match( "|^<img alt='[^']*' src='[^']*' srcset='[^']*' class='[^']*' height='[^']*' width='[^']*' />$|", coauthors_get_avatar( $guest_author ) ), 1 );
1011
 
1012
  $filename = rand_str() . '.jpg';
1013
  $contents = rand_str();
988
  public function test_coauthors_get_avatar_default() {
989
 
990
  $this->assertEmpty( coauthors_get_avatar( $this->author1->ID ) );
991
+ $this->assertEquals( preg_match( "|^<img alt='[^']*' src='[^']*' srcset='[^']*' class='[^']*' height='[^']*' width='[^']*'( loading='[^']*')?/>$|", coauthors_get_avatar( $this->author1 ) ), 1 );
992
  }
993
 
994
  /**
1007
 
1008
  $guest_author = $coauthors_plus->guest_authors->get_guest_author_by( 'id', $guest_author_id );
1009
 
1010
+ $this->assertEquals( preg_match( "|^<img alt='[^']*' src='[^']*' srcset='[^']*' class='[^']*' height='[^']*' width='[^']*'( loading='[^']*')?/>$|", coauthors_get_avatar( $guest_author ) ), 1 );
1011
 
1012
  $filename = rand_str() . '.jpg';
1013
  $contents = rand_str();