Co-Authors Plus - Version 3.4.9

Version Description

Download this release

Release Info

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

Code changes from version 3.4.8 to 3.4.9

.editorconfig DELETED
@@ -1,24 +0,0 @@
1
- # This file is for unifying the coding style for different editors and IDEs
2
- # editorconfig.org
3
-
4
- # WordPress Coding Standards
5
- # https://make.wordpress.org/core/handbook/coding-standards/
6
-
7
- root = true
8
-
9
- [*]
10
- charset = utf-8
11
- end_of_line = lf
12
- indent_size = 4
13
- tab_width = 4
14
- indent_style = tab
15
- insert_final_newline = true
16
- trim_trailing_whitespace = true
17
-
18
- [*.txt]
19
- trim_trailing_whitespace = false
20
-
21
- [*.{md,json,yml}]
22
- trim_trailing_whitespace = false
23
- indent_style = space
24
- indent_size = 2
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
.gitignore DELETED
@@ -1,6 +0,0 @@
1
- .DS_Store
2
- .svn
3
- .idea/
4
- wpcom-helper.php
5
- /composer.lock
6
- /vendor
 
 
 
 
 
 
CHANGELOG.md CHANGED
@@ -1,6 +1,14 @@
1
  # Changelog for Co-Authors Plus
2
 
3
- **3.4.7 (June 15, 2021)**
 
 
 
 
 
 
 
 
4
  * Fix AJAX author autocomplete when no author to post in author selector #803
5
 
6
  **3.4.7 (May 31, 2021)**
1
  # Changelog for Co-Authors Plus
2
 
3
+ **3.4.9 (Aug 11, 2021)**
4
+ * Fix clash on updating guest author with same slug as a WP_User #748
5
+ * Resolve warning from fix_author_page() when called too early #801
6
+ * Adjust regex on posts_where_filter to be less greedy #686
7
+ * Update deprecated GitHub hosted runner #808
8
+ * Replace deprecated jQuery shorthand methods #812
9
+ * Switch guest author metabox to aside context #746
10
+
11
+ **3.4.8 (June 15, 2021)**
12
  * Fix AJAX author autocomplete when no author to post in author selector #803
13
 
14
  **3.4.7 (May 31, 2021)**
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.7.2
6
  * Requires at least: 4.1
7
- * Stable tag: 3.4.8
8
 
9
  Assign multiple bylines to posts, pages, and custom post types via a search-as-you-type input box
10
 
2
 
3
  * Contributors: batmoo, danielbachhuber, automattic
4
  * Tags: authors, users, multiple authors, co-authors, multi-author, publishing
5
+ * Tested up to: 5.8
6
  * Requires at least: 4.1
7
+ * Stable tag: 3.4.9
8
 
9
  Assign multiple bylines to posts, pages, and custom post types via a search-as-you-type input box
10
 
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.8
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.8' );
36
 
37
  require_once dirname( __FILE__ ) . '/template-tags.php';
38
  require_once dirname( __FILE__ ) . '/deprecated.php';
@@ -335,7 +335,7 @@ class CoAuthors_Plus {
335
  public function add_coauthors_box() {
336
 
337
  if ( $this->is_post_type_enabled() && $this->current_user_can_set_authors() ) {
338
- add_meta_box( $this->coauthors_meta_box_name, apply_filters( 'coauthors_meta_box_title', __( 'Authors', 'co-authors-plus' ) ), array( $this, 'coauthors_meta_box' ), get_post_type(), apply_filters( 'coauthors_meta_box_context', 'normal' ), apply_filters( 'coauthors_meta_box_priority', 'high' ) );
339
  }
340
  }
341
 
@@ -743,7 +743,7 @@ class CoAuthors_Plus {
743
  $where = preg_replace( '/\s\b(?:' . $wpdb->posts . '\.)?post_author\s*IN\s*\(' . $id . '\)/', ' (' . $maybe_both_query . ' ' . $terms_implode . ')', $where, -1 ); // ' . $wpdb->postmeta . '.meta_id IS NOT NULL AND
744
 
745
  } else {
746
- $where = preg_replace( '/(\b(?:' . $wpdb->posts . '\.)?post_author\s*=\s*(' . $id . '))/', '(' . $maybe_both_query . ' ' . $terms_implode . ')', $where, -1 ); // ' . $wpdb->postmeta . '.meta_id IS NOT NULL AND
747
  }
748
 
749
  // the block targets the private posts clause (if it exists)
@@ -1133,6 +1133,12 @@ class CoAuthors_Plus {
1133
  */
1134
  public function fix_author_page( $selection ) {
1135
 
 
 
 
 
 
 
1136
  if ( ! is_author() ) {
1137
  return;
1138
  }
@@ -1143,9 +1149,6 @@ class CoAuthors_Plus {
1143
  }
1144
 
1145
  $author = $this->get_coauthor_by( 'user_nicename', $author_name );
1146
-
1147
- global $wp_query, $authordata;
1148
-
1149
  if ( is_object( $author ) ) {
1150
  $authordata = $author; //phpcs:ignore
1151
  $term = $this->get_author_term( $authordata );
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.9
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.9' );
36
 
37
  require_once dirname( __FILE__ ) . '/template-tags.php';
38
  require_once dirname( __FILE__ ) . '/deprecated.php';
335
  public function add_coauthors_box() {
336
 
337
  if ( $this->is_post_type_enabled() && $this->current_user_can_set_authors() ) {
338
+ add_meta_box( $this->coauthors_meta_box_name, apply_filters( 'coauthors_meta_box_title', __( 'Authors', 'co-authors-plus' ) ), array( $this, 'coauthors_meta_box' ), get_post_type(), apply_filters( 'coauthors_meta_box_context', 'side' ), apply_filters( 'coauthors_meta_box_priority', 'high' ) );
339
  }
340
  }
341
 
743
  $where = preg_replace( '/\s\b(?:' . $wpdb->posts . '\.)?post_author\s*IN\s*\(' . $id . '\)/', ' (' . $maybe_both_query . ' ' . $terms_implode . ')', $where, -1 ); // ' . $wpdb->postmeta . '.meta_id IS NOT NULL AND
744
 
745
  } else {
746
+ $where = preg_replace( '/(\b(?:' . $wpdb->posts . '\.)?post_author\s*=\s*(' . $id . '[^\d]))/', '(' . $maybe_both_query . ' ' . $terms_implode . ')', $where, -1 ); // ' . $wpdb->postmeta . '.meta_id IS NOT NULL AND
747
  }
748
 
749
  // the block targets the private posts clause (if it exists)
1133
  */
1134
  public function fix_author_page( $selection ) {
1135
 
1136
+ global $wp_query, $authordata;
1137
+
1138
+ if ( ! isset( $wp_query ) ) {
1139
+ return;
1140
+ }
1141
+
1142
  if ( ! is_author() ) {
1143
  return;
1144
  }
1149
  }
1150
 
1151
  $author = $this->get_coauthor_by( 'user_nicename', $author_name );
 
 
 
1152
  if ( is_object( $author ) ) {
1153
  $authordata = $author; //phpcs:ignore
1154
  $term = $this->get_author_term( $authordata );
js/co-authors-plus.js CHANGED
@@ -32,7 +32,7 @@ jQuery( document ).ready(function () {
32
 
33
  $tag.hide();
34
  $co.show()
35
- .focus()
36
  ;
37
 
38
  $co.previousAuthor = $tag.text();
@@ -96,13 +96,13 @@ jQuery( document ).ready(function () {
96
  }
97
  }
98
 
99
- co.bind( 'blur', coauthors_stop_editing );
100
 
101
  // Set the value for the auto-suggest box to the co-author's name and hide it
102
  // unescape() is deprecated, so replacing it with decodeURIComponent() here and every places.
103
  co.val( decodeURIComponent( author.name ) )
104
  .hide()
105
- .unbind( 'focus' )
106
  ;
107
 
108
  return true;
@@ -146,7 +146,7 @@ jQuery( document ).ready(function () {
146
  var deleteBtn = jQuery( '<span/>' )
147
  .addClass( 'delete-coauthor' )
148
  .text( coAuthorsPlusStrings.delete_label )
149
- .bind( 'click', coauthors_delete_onclick )
150
  ;
151
  $options.append( deleteBtn );
152
  }
@@ -175,15 +175,15 @@ jQuery( document ).ready(function () {
175
  onSelect: coauthors_autosuggest_select,
176
  delay: 1000
177
  })
178
- .keydown( coauthors_autosuggest_keydown )
179
  ;
180
 
181
  if ( authorName )
182
  $co.attr( 'value', decodeURIComponent( authorName ) );
183
  else
184
  $co.attr( 'value', coAuthorsPlusStrings.search_box_text )
185
- .focus( function(){ $co.val( '' ) } )
186
- .blur( function(){ $co.val( coAuthorsPlusStrings.search_box_text ) } )
187
  ;
188
 
189
  return $co;
@@ -196,16 +196,16 @@ jQuery( document ).ready(function () {
196
  var vals = this.value.split( '∣' );
197
 
198
  var author = {}
199
- author.id = jQuery.trim( vals[0] );
200
- author.login = jQuery.trim( vals[1] );
201
- author.name = jQuery.trim( vals[2] );
202
- author.email = jQuery.trim( vals[3] );
203
  if( author.avatar !== '' ){
204
- author.avatar = jQuery.trim( vals[5] );
205
  }
206
 
207
  // Decode user-nicename if it has special characters in it.
208
- author.nicename = decodeURIComponent( jQuery.trim( vals[4] ) );
209
 
210
  if ( author.id=='New' ) {
211
  coauthors_new_author_display( name );
@@ -250,7 +250,7 @@ jQuery( document ).ready(function () {
250
  .attr( 'title', coAuthorsPlusStrings.input_box_title )
251
  .addClass( 'coauthor-tag' )
252
  // Add Click event to edit
253
- .click( coauthors_edit_onclick );
254
  return $tag;
255
  }
256
 
32
 
33
  $tag.hide();
34
  $co.show()
35
+ .on( 'focus' )
36
  ;
37
 
38
  $co.previousAuthor = $tag.text();
96
  }
97
  }
98
 
99
+ co.on( 'blur', coauthors_stop_editing );
100
 
101
  // Set the value for the auto-suggest box to the co-author's name and hide it
102
  // unescape() is deprecated, so replacing it with decodeURIComponent() here and every places.
103
  co.val( decodeURIComponent( author.name ) )
104
  .hide()
105
+ .off( 'focus' )
106
  ;
107
 
108
  return true;
146
  var deleteBtn = jQuery( '<span/>' )
147
  .addClass( 'delete-coauthor' )
148
  .text( coAuthorsPlusStrings.delete_label )
149
+ .on( 'click', coauthors_delete_onclick )
150
  ;
151
  $options.append( deleteBtn );
152
  }
175
  onSelect: coauthors_autosuggest_select,
176
  delay: 1000
177
  })
178
+ .on( 'keydown', coauthors_autosuggest_keydown )
179
  ;
180
 
181
  if ( authorName )
182
  $co.attr( 'value', decodeURIComponent( authorName ) );
183
  else
184
  $co.attr( 'value', coAuthorsPlusStrings.search_box_text )
185
+ .on( 'focus', function(){ $co.val( '' ) } )
186
+ .on( 'blur', function(){ $co.val( coAuthorsPlusStrings.search_box_text ) } )
187
  ;
188
 
189
  return $co;
196
  var vals = this.value.split( '∣' );
197
 
198
  var author = {}
199
+ author.id = vals[0].trim();
200
+ author.login = vals[1].trim();
201
+ author.name = vals[2].trim();
202
+ author.email = vals[3].trim();
203
  if( author.avatar !== '' ){
204
+ author.avatar = vals[5].trim();
205
  }
206
 
207
  // Decode user-nicename if it has special characters in it.
208
+ author.nicename = decodeURIComponent( vals[4].trim() );
209
 
210
  if ( author.id=='New' ) {
211
  coauthors_new_author_display( name );
250
  .attr( 'title', coAuthorsPlusStrings.input_box_title )
251
  .addClass( 'coauthor-tag' )
252
  // Add Click event to edit
253
+ .on( 'click', coauthors_edit_onclick );
254
  return $tag;
255
  }
256
 
php/class-coauthors-guest-authors.php CHANGED
@@ -789,7 +789,11 @@ class CoAuthors_Guest_Authors {
789
  if ( $user
790
  && is_user_member_of_blog( $user->ID, get_current_blog_id() )
791
  && $user->user_login != get_post_meta( $original_args['ID'], $this->get_post_meta_key( 'linked_account' ), true ) ) {
792
- wp_die( esc_html__( 'Guest authors cannot be created with the same user_login value as a user. Try creating a profile from the user on the Manage Users listing instead.', 'co-authors-plus' ) );
 
 
 
 
793
  }
794
 
795
  // Guest authors can't have the same post_name value
789
  if ( $user
790
  && is_user_member_of_blog( $user->ID, get_current_blog_id() )
791
  && $user->user_login != get_post_meta( $original_args['ID'], $this->get_post_meta_key( 'linked_account' ), true ) ) {
792
+ // if user has selected to link account to matching user we don't have to bail
793
+ if ( isset( $_POST['cap-linked_account'] ) && (int) $_POST['cap-linked_account'] === (int) $user->ID ) {
794
+ return $post_data;
795
+ }
796
+ wp_die( esc_html__( 'There is a WordPress user with the same username as this guest author, please go back and link them in order to update.', 'co-authors-plus' ) );
797
  }
798
 
799
  // Guest authors can't have the same post_name value
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.7.2
5
  Requires at least: 4.1
6
- Stable tag: 3.4.8
7
 
8
  Assign multiple bylines to posts, pages, and custom post types via a search-as-you-type input box
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.8
5
  Requires at least: 4.1
6
+ Stable tag: 3.4.9
7
 
8
  Assign multiple bylines to posts, pages, and custom post types via a search-as-you-type input box
9