Version Description
Download this release
Release Info
| Developer | batmoo |
| Plugin | |
| Version | 2.5.2 |
| Comparing to | |
| See all releases | |
Code changes from version 2.5.1 to 2.5.2
- co-authors-plus.php +41 -28
- readme.txt +9 -2
- template-tags.php +19 -14
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: 2.5.
|
| 7 |
Author: Mohammad Jangda
|
| 8 |
Author URI: http://digitalize.ca
|
| 9 |
Copyright: Some parts (C) 2009-2011, Mohammad Jangda; Other parts (C) 2008, Weston Ruter
|
|
@@ -25,6 +25,8 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
|
| 25 |
|
| 26 |
*/
|
| 27 |
|
|
|
|
|
|
|
| 28 |
if( ! defined( 'COAUTHORS_PLUS_DEBUG' ) )
|
| 29 |
define( 'COAUTHORS_PLUS_DEBUG', false );
|
| 30 |
|
|
@@ -43,8 +45,6 @@ if( ! defined( 'COAUTHORS_DEFAULT_AFTER' ) )
|
|
| 43 |
define( 'COAUTHORS_PLUS_PATH', dirname( __FILE__ ) );
|
| 44 |
define( 'COAUTHORS_PLUS_URL', plugin_dir_url( __FILE__ ) );
|
| 45 |
|
| 46 |
-
define( 'COAUTHORS_PLUS_VERSION', '2.5.1' );
|
| 47 |
-
|
| 48 |
class coauthors_plus {
|
| 49 |
|
| 50 |
// Name for the taxonomy we're using to store coauthors
|
|
@@ -337,11 +337,15 @@ class coauthors_plus {
|
|
| 337 |
global $wpdb, $wp_query;
|
| 338 |
|
| 339 |
if( is_author() ){
|
| 340 |
-
// Check to see that JOIN hasn't already been added. Props michaelingp
|
| 341 |
-
$
|
|
|
|
| 342 |
|
| 343 |
-
if( strpos( $join, $
|
| 344 |
-
$join .= $
|
|
|
|
|
|
|
|
|
|
| 345 |
}
|
| 346 |
}
|
| 347 |
|
|
@@ -382,21 +386,29 @@ class coauthors_plus {
|
|
| 382 |
* Filters post data before saving to db to set post_author
|
| 383 |
*/
|
| 384 |
function coauthors_set_post_author_field( $data ) {
|
| 385 |
-
|
| 386 |
-
|
| 387 |
-
|
| 388 |
-
|
| 389 |
-
|
| 390 |
-
|
| 391 |
-
|
| 392 |
-
|
| 393 |
-
|
| 394 |
-
|
| 395 |
-
|
| 396 |
-
|
| 397 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 398 |
}
|
| 399 |
}
|
|
|
|
| 400 |
return $data;
|
| 401 |
}
|
| 402 |
|
|
@@ -408,15 +420,16 @@ class coauthors_plus {
|
|
| 408 |
function coauthors_update_post( $post_id, $post ) {
|
| 409 |
$post_type = $post->post_type;
|
| 410 |
|
| 411 |
-
if (
|
|
|
|
| 412 |
|
| 413 |
-
|
| 414 |
-
|
| 415 |
-
|
| 416 |
-
|
| 417 |
-
|
| 418 |
-
|
| 419 |
-
|
| 420 |
}
|
| 421 |
}
|
| 422 |
}
|
| 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: 2.5.2
|
| 7 |
Author: Mohammad Jangda
|
| 8 |
Author URI: http://digitalize.ca
|
| 9 |
Copyright: Some parts (C) 2009-2011, Mohammad Jangda; Other parts (C) 2008, Weston Ruter
|
| 25 |
|
| 26 |
*/
|
| 27 |
|
| 28 |
+
define( 'COAUTHORS_PLUS_VERSION', '2.5.2' );
|
| 29 |
+
|
| 30 |
if( ! defined( 'COAUTHORS_PLUS_DEBUG' ) )
|
| 31 |
define( 'COAUTHORS_PLUS_DEBUG', false );
|
| 32 |
|
| 45 |
define( 'COAUTHORS_PLUS_PATH', dirname( __FILE__ ) );
|
| 46 |
define( 'COAUTHORS_PLUS_URL', plugin_dir_url( __FILE__ ) );
|
| 47 |
|
|
|
|
|
|
|
| 48 |
class coauthors_plus {
|
| 49 |
|
| 50 |
// Name for the taxonomy we're using to store coauthors
|
| 337 |
global $wpdb, $wp_query;
|
| 338 |
|
| 339 |
if( is_author() ){
|
| 340 |
+
// Check to see that JOIN hasn't already been added. Props michaelingp and nbaxley
|
| 341 |
+
$term_relationship_join = " INNER JOIN {$wpdb->term_relationships} ON ({$wpdb->posts}.ID = {$wpdb->term_relationships}.object_id)";
|
| 342 |
+
$term_taxonomy_join = " INNER JOIN {$wpdb->term_taxonomy} ON ( {$wpdb->term_relationships}.term_taxonomy_id = {$wpdb->term_taxonomy}.term_taxonomy_id )";
|
| 343 |
|
| 344 |
+
if( strpos( $join, trim( $term_relationship_join ) ) === false ) {
|
| 345 |
+
$join .= $term_relationship_join;
|
| 346 |
+
}
|
| 347 |
+
if( strpos( $join, trim( $term_taxonomy_join ) ) === false ) {
|
| 348 |
+
$join .= $term_taxonomy_join;
|
| 349 |
}
|
| 350 |
}
|
| 351 |
|
| 386 |
* Filters post data before saving to db to set post_author
|
| 387 |
*/
|
| 388 |
function coauthors_set_post_author_field( $data ) {
|
| 389 |
+
|
| 390 |
+
// Bail on autosave
|
| 391 |
+
if ( defined( 'DOING_AUTOSAVE' ) && !DOING_AUTOSAVE )
|
| 392 |
+
return $data;
|
| 393 |
+
|
| 394 |
+
// Bail on revisions
|
| 395 |
+
if( $data['post_type'] == 'revision' )
|
| 396 |
+
return $data;
|
| 397 |
+
|
| 398 |
+
if( isset( $_REQUEST['coauthors-nonce'] ) && is_array( $_POST['coauthors'] ) ) {
|
| 399 |
+
$author = $_POST['coauthors'][0];
|
| 400 |
+
if( $author ) {
|
| 401 |
+
$author_data = get_user_by( 'login', $author );
|
| 402 |
+
$data['post_author'] = $author_data->ID;
|
| 403 |
+
}
|
| 404 |
+
} else {
|
| 405 |
+
// If for some reason we don't have the coauthors fields set
|
| 406 |
+
if( ! isset( $data['post_author'] ) ) {
|
| 407 |
+
$user = wp_get_current_user();
|
| 408 |
+
$data['post_author'] = $user->ID;
|
| 409 |
}
|
| 410 |
}
|
| 411 |
+
|
| 412 |
return $data;
|
| 413 |
}
|
| 414 |
|
| 420 |
function coauthors_update_post( $post_id, $post ) {
|
| 421 |
$post_type = $post->post_type;
|
| 422 |
|
| 423 |
+
if ( defined( 'DOING_AUTOSAVE' ) && !DOING_AUTOSAVE )
|
| 424 |
+
return;
|
| 425 |
|
| 426 |
+
if( isset( $_POST['coauthors-nonce'] ) && isset( $_POST['coauthors'] ) ) {
|
| 427 |
+
check_admin_referer( 'coauthors-edit', 'coauthors-nonce' );
|
| 428 |
+
|
| 429 |
+
if( $this->current_user_can_set_authors() ){
|
| 430 |
+
$coauthors = (array) $_POST['coauthors'];
|
| 431 |
+
$coauthors = array_map( 'esc_html', $coauthors );
|
| 432 |
+
return $this->add_coauthors( $post_id, $coauthors );
|
| 433 |
}
|
| 434 |
}
|
| 435 |
}
|
readme.txt
CHANGED
|
@@ -4,7 +4,7 @@ Donate link: http://digitalize.ca/donate
|
|
| 4 |
Tags: authors, users, multiple authors, coauthors, multi-author
|
| 5 |
Tested up to: 3.1
|
| 6 |
Requires at least: 3.0
|
| 7 |
-
Stable tag: 2.5.
|
| 8 |
|
| 9 |
Allows multiple authors to be assigned to a Posts via search-as-you-type input boxes.
|
| 10 |
|
|
@@ -20,11 +20,18 @@ The extended version incorporates search-as-you-type functionality for adding us
|
|
| 20 |
|
| 21 |
== Changelog ==
|
| 22 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 23 |
= 2011-03-26 / 2.5.1 =
|
| 24 |
|
| 25 |
* Fix with author post count (throwing errors)
|
| 26 |
|
| 27 |
-
= 2011-03-26 /
|
| 28 |
|
| 29 |
* Custom Post Type Support
|
| 30 |
* Compatibility with WP 3.0 and 3.1
|
| 4 |
Tags: authors, users, multiple authors, coauthors, multi-author
|
| 5 |
Tested up to: 3.1
|
| 6 |
Requires at least: 3.0
|
| 7 |
+
Stable tag: 2.5.2
|
| 8 |
|
| 9 |
Allows multiple authors to be assigned to a Posts via search-as-you-type input boxes.
|
| 10 |
|
| 20 |
|
| 21 |
== Changelog ==
|
| 22 |
|
| 23 |
+
= 2011-04-23 / 2.5.2 =
|
| 24 |
+
|
| 25 |
+
* Bug: Couldn't query terms and authors at the same time (props nbaxley)
|
| 26 |
+
* Bug: Authors with empty fields (e.g. first name) were displaying blank in some cases
|
| 27 |
+
* Bug: authors with spaces in usernames not getting saved (props MLmsw, Ruben S. and others!)
|
| 28 |
+
* Bug: revisions getting wrong user attached (props cliquenoir!)
|
| 29 |
+
|
| 30 |
= 2011-03-26 / 2.5.1 =
|
| 31 |
|
| 32 |
* Fix with author post count (throwing errors)
|
| 33 |
|
| 34 |
+
= 2011-03-26 / 2.5 =
|
| 35 |
|
| 36 |
* Custom Post Type Support
|
| 37 |
* Compatibility with WP 3.0 and 3.1
|
template-tags.php
CHANGED
|
@@ -130,23 +130,28 @@ function coauthors__echo( $tag, $type = 'tag', $separators = array(), $tag_args
|
|
| 130 |
|
| 131 |
$i = new CoAuthorsIterator();
|
| 132 |
$output .= $separators['before'];
|
| 133 |
-
|
| 134 |
-
|
| 135 |
-
|
| 136 |
-
|
| 137 |
-
$output .= $i->current_author->$tag;
|
| 138 |
-
elseif( $type == 'callback' && is_callable( $tag ) )
|
| 139 |
-
$output .= call_user_func( $tag, $i->current_author );
|
| 140 |
-
}
|
| 141 |
-
while( $i->iterate() ){
|
| 142 |
-
$output .= $i->is_last() ? $separators['betweenLast'] : $separators['between'];
|
| 143 |
if( $type == 'tag' )
|
| 144 |
-
$
|
| 145 |
elseif( $type == 'field' && isset( $i->current_author->$tag ) )
|
| 146 |
-
$
|
| 147 |
elseif( $type == 'callback' && is_callable( $tag ) )
|
| 148 |
-
$
|
| 149 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 150 |
$output .= $separators['after'];
|
| 151 |
|
| 152 |
if( $echo )
|
| 130 |
|
| 131 |
$i = new CoAuthorsIterator();
|
| 132 |
$output .= $separators['before'];
|
| 133 |
+
$i->iterate();
|
| 134 |
+
do {
|
| 135 |
+
$author_text = '';
|
| 136 |
+
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 137 |
if( $type == 'tag' )
|
| 138 |
+
$author_text = $tag( $tag_args );
|
| 139 |
elseif( $type == 'field' && isset( $i->current_author->$tag ) )
|
| 140 |
+
$author_text = $i->current_author->$tag;
|
| 141 |
elseif( $type == 'callback' && is_callable( $tag ) )
|
| 142 |
+
$author_text = call_user_func( $tag, $i->current_author );
|
| 143 |
+
|
| 144 |
+
// Fallback to user_login if we get something empty
|
| 145 |
+
if( empty( $author_text ) )
|
| 146 |
+
$author_text = $i->current_author->user_login;
|
| 147 |
+
|
| 148 |
+
// Append separators
|
| 149 |
+
if( ! $i->is_first() )
|
| 150 |
+
$output .= $i->is_last() ? $separators['betweenLast'] : $separators['between'];
|
| 151 |
+
|
| 152 |
+
$output .= $author_text;
|
| 153 |
+
} while( $i->iterate() );
|
| 154 |
+
|
| 155 |
$output .= $separators['after'];
|
| 156 |
|
| 157 |
if( $echo )
|
