Co-Authors Plus - Version 3.0.2

Version Description

(Nov. 23, 2012) = * Bug fix: Fall back to non-pretty permalinks when the author permastruct is empty, so that coauthors_posts_links() doesn't link to the homepage

Download this release

Release Info

Developer danielbachhuber
Plugin Icon wp plugin Co-Authors Plus
Version 3.0.2
Comparing to
See all releases

Code changes from version 3.0.1 to 3.0.2

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.0.1
7
  Author: Mohammad Jangda, Daniel Bachhuber, Automattic
8
  Copyright: 2008-2012 Shared and distributed between Mohammad Jangda, Daniel Bachhuber, Weston Ruter
9
 
@@ -24,7 +24,7 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
24
 
25
  */
26
 
27
- define( 'COAUTHORS_PLUS_VERSION', '3.0.1' );
28
 
29
  define( 'COAUTHORS_PLUS_PATH', dirname( __FILE__ ) );
30
  define( 'COAUTHORS_PLUS_URL', plugin_dir_url( __FILE__ ) );
@@ -207,11 +207,11 @@ class coauthors_plus {
207
  * @param string $value Value to search for
208
  * @param object|false $coauthor The co-author on success, false on failure
209
  */
210
- function get_coauthor_by( $key, $value ) {
211
 
212
  // If Guest Authors are enabled, prioritize those profiles
213
  if ( $this->is_guest_authors_enabled() ) {
214
- $guest_author = $this->guest_authors->get_guest_author_by( $key, $value );
215
  if ( is_object( $guest_author ) ) {
216
  return $guest_author;
217
  }
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.0.2
7
  Author: Mohammad Jangda, Daniel Bachhuber, Automattic
8
  Copyright: 2008-2012 Shared and distributed between Mohammad Jangda, Daniel Bachhuber, Weston Ruter
9
 
24
 
25
  */
26
 
27
+ define( 'COAUTHORS_PLUS_VERSION', '3.0.2' );
28
 
29
  define( 'COAUTHORS_PLUS_PATH', dirname( __FILE__ ) );
30
  define( 'COAUTHORS_PLUS_URL', plugin_dir_url( __FILE__ ) );
207
  * @param string $value Value to search for
208
  * @param object|false $coauthor The co-author on success, false on failure
209
  */
210
+ function get_coauthor_by( $key, $value, $force = false ) {
211
 
212
  // If Guest Authors are enabled, prioritize those profiles
213
  if ( $this->is_guest_authors_enabled() ) {
214
+ $guest_author = $this->guest_authors->get_guest_author_by( $key, $value, $force );
215
  if ( is_object( $guest_author ) ) {
216
  return $guest_author;
217
  }
php/class-coauthors-guest-authors.php CHANGED
@@ -731,11 +731,11 @@ class CoAuthors_Guest_Authors
731
  * @param string $value Value to search for
732
  * @param object|false $coauthor The guest author on success, false on failure
733
  */
734
- function get_guest_author_by( $key, $value ) {
735
  global $wpdb;
736
 
737
  $cache_key = md5( 'guest-author-' . $key . '-' . $value );
738
- if ( false !== ( $retval = wp_cache_get( $cache_key, self::$cache_group ) ) )
739
  return $retval;
740
 
741
  switch( $key ) {
@@ -1007,7 +1007,7 @@ class CoAuthors_Guest_Authors
1007
  }
1008
 
1009
  // The user login field shouldn't collide with any existing users
1010
- if ( 'user_login' == $field['key'] && $existing_coauthor = $coauthors_plus->get_coauthor_by( 'user_login', $args['user_login'] ) ) {
1011
  if ( 'guest-author' == $existing_coauthor->type )
1012
  return new WP_Error( 'duplicate-field', __( 'user_login cannot duplicate existing guest author or mapped user', 'co-authors-plus' ) );
1013
  }
@@ -1217,8 +1217,12 @@ class CoAuthors_Guest_Authors
1217
  } else {
1218
  global $wp_rewrite;
1219
  $link = $wp_rewrite->get_author_permastruct();
1220
- $link = str_replace('%author%', $author_nicename, $link);
1221
- $link = home_url( user_trailingslashit( $link ) );
 
 
 
 
1222
  }
1223
  return $link;
1224
 
731
  * @param string $value Value to search for
732
  * @param object|false $coauthor The guest author on success, false on failure
733
  */
734
+ function get_guest_author_by( $key, $value, $force = false ) {
735
  global $wpdb;
736
 
737
  $cache_key = md5( 'guest-author-' . $key . '-' . $value );
738
+ if ( false == $force && false !== ( $retval = wp_cache_get( $cache_key, self::$cache_group ) ) )
739
  return $retval;
740
 
741
  switch( $key ) {
1007
  }
1008
 
1009
  // The user login field shouldn't collide with any existing users
1010
+ if ( 'user_login' == $field['key'] && $existing_coauthor = $coauthors_plus->get_coauthor_by( 'user_login', $args['user_login'], true ) ) {
1011
  if ( 'guest-author' == $existing_coauthor->type )
1012
  return new WP_Error( 'duplicate-field', __( 'user_login cannot duplicate existing guest author or mapped user', 'co-authors-plus' ) );
1013
  }
1217
  } else {
1218
  global $wp_rewrite;
1219
  $link = $wp_rewrite->get_author_permastruct();
1220
+ if ( $link ) {
1221
+ $link = str_replace('%author%', $author_nicename, $link);
1222
+ $link = home_url( user_trailingslashit( $link ) );
1223
+ } else {
1224
+ $link = add_query_arg( 'author_name', $author_nicename, home_url() );
1225
+ }
1226
  }
1227
  return $link;
1228
 
readme.txt CHANGED
@@ -3,7 +3,7 @@ Contributors: batmoo, danielbachhuber, automattic
3
  Tags: authors, users, multiple authors, coauthors, multi-author, publishing
4
  Tested up to: 3.4.2
5
  Requires at least: 3.3
6
- Stable tag: 3.0.1
7
 
8
  Assign multiple bylines to posts, pages, and custom post types via a search-as-you-type input box
9
 
@@ -34,6 +34,9 @@ Bug fixes and minor enhancements
34
 
35
  == Changelog ==
36
 
 
 
 
37
  = 3.0.1 (Nov. 21, 2012) =
38
  * Add your own custom columns to the guest authors table using filters. Props [cfg](https://github.com/cfg)
39
  * A new wp-cli subcommand for renaming co-authors and another for removing author terms mistakenly assigned to revisions
3
  Tags: authors, users, multiple authors, coauthors, multi-author, publishing
4
  Tested up to: 3.4.2
5
  Requires at least: 3.3
6
+ Stable tag: 3.0.2
7
 
8
  Assign multiple bylines to posts, pages, and custom post types via a search-as-you-type input box
9
 
34
 
35
  == Changelog ==
36
 
37
+ = 3.0.2 (Nov. 23, 2012) =
38
+ * Bug fix: Fall back to non-pretty permalinks when the author permastruct is empty, so that coauthors_posts_links() doesn't link to the homepage
39
+
40
  = 3.0.1 (Nov. 21, 2012) =
41
  * Add your own custom columns to the guest authors table using filters. Props [cfg](https://github.com/cfg)
42
  * A new wp-cli subcommand for renaming co-authors and another for removing author terms mistakenly assigned to revisions