Co-Authors Plus - Version 3.0.4

Version Description

Bug fixes and the ability to automatically add co-authors to your feeds.

Download this release

Release Info

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

Code changes from version 3.0.3 to 3.0.4

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.3
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.3' );
28
29
define( 'COAUTHORS_PLUS_PATH', dirname( __FILE__ ) );
30
define( 'COAUTHORS_PLUS_URL', plugin_dir_url( __FILE__ ) );
@@ -157,7 +157,7 @@ class coauthors_plus {
157
);
158
$post_types_with_authors = array_values( get_post_types() );
159
foreach( $post_types_with_authors as $key => $name ) {
160
- if ( ! post_type_supports( $name, 'author' ) || 'revision' == $name )
161
unset( $post_types_with_authors[$key] );
162
}
163
$this->supported_post_types = apply_filters( 'coauthors_supported_post_types', $post_types_with_authors );
@@ -333,6 +333,7 @@ class coauthors_plus {
333
<input type="text" name="coauthorsinput[]" readonly="readonly" value="<?php echo esc_attr( $coauthor->display_name ); ?>" />
334
<input type="text" name="coauthors[]" value="<?php echo esc_attr( $coauthor->user_login ); ?>" />
335
<input type="text" name="coauthorsemails[]" value="<?php echo esc_attr( $coauthor->user_email ); ?>" />
336
</span>
337
</li>
338
<?php
@@ -554,7 +555,8 @@ class coauthors_plus {
554
}
555
556
// Whether or not to include the original 'post_author' value in the query
557
- if ( $this->force_guest_authors )
558
$maybe_both = false;
559
else
560
$maybe_both = apply_filters( 'coauthors_plus_should_query_post_author', true );
@@ -697,7 +699,7 @@ class coauthors_plus {
697
// Add each co-author to the post meta
698
foreach( array_unique( $coauthors ) as $key => $author_name ){
699
700
- $author = $this->get_coauthor_by( 'user_login', $author_name );
701
$term = $this->update_author_term( $author );
702
$coauthors[$key] = $term->slug;
703
}
@@ -844,7 +846,7 @@ class coauthors_plus {
844
$authors = $this->search_authors( $search, $ignore );
845
846
foreach( $authors as $author ) {
847
- echo $author->ID ." | ". $author->user_login ." | ". $author->display_name ." | ". $author->user_email ."\n";
848
}
849
850
die();
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.4
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.4' );
28
29
define( 'COAUTHORS_PLUS_PATH', dirname( __FILE__ ) );
30
define( 'COAUTHORS_PLUS_URL', plugin_dir_url( __FILE__ ) );
157
);
158
$post_types_with_authors = array_values( get_post_types() );
159
foreach( $post_types_with_authors as $key => $name ) {
160
+ if ( ! post_type_supports( $name, 'author' ) || in_array( $name, array( 'revision', 'attachment' ) ) )
161
unset( $post_types_with_authors[$key] );
162
}
163
$this->supported_post_types = apply_filters( 'coauthors_supported_post_types', $post_types_with_authors );
333
<input type="text" name="coauthorsinput[]" readonly="readonly" value="<?php echo esc_attr( $coauthor->display_name ); ?>" />
334
<input type="text" name="coauthors[]" value="<?php echo esc_attr( $coauthor->user_login ); ?>" />
335
<input type="text" name="coauthorsemails[]" value="<?php echo esc_attr( $coauthor->user_email ); ?>" />
336
+ <input type="text" name="coauthorsnicenames[]" value="<?php echo esc_attr( $coauthor->user_nicename ); ?>" />
337
</span>
338
</li>
339
<?php
555
}
556
557
// Whether or not to include the original 'post_author' value in the query
558
+ // Don't include it if we're forcing guest authors, or it's obvious our query is for a guest author's posts
559
+ if ( $this->force_guest_authors || stripos( $where, '.post_author = 0)' ) )
560
$maybe_both = false;
561
else
562
$maybe_both = apply_filters( 'coauthors_plus_should_query_post_author', true );
699
// Add each co-author to the post meta
700
foreach( array_unique( $coauthors ) as $key => $author_name ){
701
702
+ $author = $this->get_coauthor_by( 'user_nicename', $author_name );
703
$term = $this->update_author_term( $author );
704
$coauthors[$key] = $term->slug;
705
}
846
$authors = $this->search_authors( $search, $ignore );
847
848
foreach( $authors as $author ) {
849
+ echo $author->ID ." | ". $author->user_login ." | ". $author->display_name ." | ". $author->user_email ." | ". $author->user_nicename . "\n";
850
}
851
852
die();
js/co-authors-plus.js CHANGED
@@ -52,7 +52,7 @@ jQuery(document).ready(function () {
52
;
53
54
// Update the value of the hidden input
55
- co.siblings('input[name="coauthors[]"]').val(author.login);
56
}
57
58
@@ -215,6 +215,7 @@ jQuery(document).ready(function () {
215
author.login = jQuery.trim(vals[1]);
216
author.name = jQuery.trim(vals[2]);
217
author.email = jQuery.trim(vals[3]);
218
219
if(author.id=="New") {
220
//alert('Eventually, this will allow you to add a new author right from here. But it\'s not ready yet. *sigh*');
@@ -304,7 +305,7 @@ jQuery(document).ready(function () {
304
'type': 'hidden',
305
'id': 'coauthors_hidden_input',
306
'name': 'coauthors[]',
307
- 'value': unescape(author.login)
308
})
309
;
310
@@ -392,6 +393,7 @@ jQuery(document).ready(function () {
392
var $post_coauthor_logins = jQuery('input[name="coauthors[]"]');
393
var $post_coauthor_names = jQuery('input[name="coauthorsinput[]"]');
394
var $post_coauthor_emails = jQuery('input[name="coauthorsemails[]"]');
395
396
post_coauthors = [];
397
@@ -400,6 +402,7 @@ jQuery(document).ready(function () {
400
login: $post_coauthor_logins[i].value,
401
name: $post_coauthor_names[i].value,
402
email: $post_coauthor_emails[i].value,
403
});
404
}
405
52
;
53
54
// Update the value of the hidden input
55
+ co.siblings('input[name="coauthors[]"]').val(author.nicename);
56
}
57
58
215
author.login = jQuery.trim(vals[1]);
216
author.name = jQuery.trim(vals[2]);
217
author.email = jQuery.trim(vals[3]);
218
+ author.nicename = jQuery.trim(vals[4]);
219
220
if(author.id=="New") {
221
//alert('Eventually, this will allow you to add a new author right from here. But it\'s not ready yet. *sigh*');
305
'type': 'hidden',
306
'id': 'coauthors_hidden_input',
307
'name': 'coauthors[]',
308
+ 'value': unescape(author.nicename)
309
})
310
;
311
393
var $post_coauthor_logins = jQuery('input[name="coauthors[]"]');
394
var $post_coauthor_names = jQuery('input[name="coauthorsinput[]"]');
395
var $post_coauthor_emails = jQuery('input[name="coauthorsemails[]"]');
396
+ var $post_coauthor_nicenames = jQuery('input[name="coauthorsnicenames[]"]');
397
398
post_coauthors = [];
399
402
login: $post_coauthor_logins[i].value,
403
name: $post_coauthor_names[i].value,
404
email: $post_coauthor_emails[i].value,
405
+ nicename: $post_coauthor_nicenames[i].value
406
});
407
}
408
php/class-coauthors-template-filters.php CHANGED
@@ -9,6 +9,10 @@ class CoAuthors_Template_Filters {
9
function __construct() {
10
add_filter( 'the_author', array( $this, 'filter_the_author' ) );
11
add_filter( 'the_author_posts_link', array( $this, 'filter_the_author_posts_link' ) );
12
}
13
14
function filter_the_author() {
@@ -18,4 +22,28 @@ class CoAuthors_Template_Filters {
18
function filter_the_author_posts_link() {
19
return coauthors_posts_links( null, null, null, null, false );
20
}
21
}
9
function __construct() {
10
add_filter( 'the_author', array( $this, 'filter_the_author' ) );
11
add_filter( 'the_author_posts_link', array( $this, 'filter_the_author_posts_link' ) );
12
+
13
+ // Add support for Guest Authors in RSS feeds.
14
+ add_filter( 'the_author', array( $this, 'filter_the_author_rss' ), 15 ); // Override CoAuthors_Template_Filters::filter_the_author for RSS feeds
15
+ add_action( 'rss2_item', array( $this, 'action_add_rss_guest_authors' ) );
16
}
17
18
function filter_the_author() {
22
function filter_the_author_posts_link() {
23
return coauthors_posts_links( null, null, null, null, false );
24
}
25
+
26
+ function filter_the_author_rss( $the_author ) {
27
+ if ( !is_feed() || !function_exists( 'coauthors' ) )
28
+ return $the_author;
29
+
30
+ $coauthors = (array)get_coauthors();
31
+ if( count($coauthors) >= 1 && isset($coauthors[0]->display_name) ) {
32
+ return $coauthors[0]->display_name;
33
+ } else {
34
+ return $the_author;
35
+ }
36
+ }
37
+
38
+ function action_add_rss_guest_authors() {
39
+ $coauthors = get_coauthors();
40
+
41
+ // remove the first guest author who is added to the first dc:creator element
42
+ array_shift($coauthors);
43
+
44
+ foreach( $coauthors as $coauthor ) {
45
+ echo " <dc:creator><![CDATA[" . $coauthor->display_name . "]]></dc:creator>\n";
46
+ }
47
+ }
48
+
49
}
php/class-wp-cli.php CHANGED
@@ -429,6 +429,15 @@ class CoAuthorsPlus_Command extends WP_CLI_Command {
429
$new_count = get_term_by( 'id', $author_term->term_id, $coauthors_plus->coauthor_taxonomy )->count;
430
WP_CLI::line( "Term {$author_term->slug} ({$author_term->term_id}) changed from {$old_count} to {$new_count} and the description was refreshed" );
431
}
432
WP_CLI::success( "All done" );
433
}
434
429
$new_count = get_term_by( 'id', $author_term->term_id, $coauthors_plus->coauthor_taxonomy )->count;
430
WP_CLI::line( "Term {$author_term->slug} ({$author_term->term_id}) changed from {$old_count} to {$new_count} and the description was refreshed" );
431
}
432
+ // Create author terms for any users that don't have them
433
+ $users = get_users();
434
+ foreach( $users as $user ) {
435
+ $term = $coauthors_plus->get_author_term( $user );
436
+ if ( empty( $term ) || empty( $term->description ) ) {
437
+ $coauthors_plus->update_author_term( $user );
438
+ WP_CLI::line( "Created author term for {$user->user_login}" );
439
+ }
440
+ }
441
WP_CLI::success( "All done" );
442
}
443
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: 3.4.2
5
Requires at least: 3.3
6
- Stable tag: 3.0.3
7
8
Assign multiple bylines to posts, pages, and custom post types via a search-as-you-type input box
9
@@ -27,13 +27,25 @@ If you've just installed Co-Authors Plus, you might notice that the bylines are
27
28
When a user is deleted from WordPress, they will be removed from all posts for which they are co-authors. If you chose to reassign their posts to another user, that user will be set as the coauthor instead.
29
30
== Upgrade Notice ==
31
32
= 3.0.1 =
33
Bug fixes and minor enhancements
34
35
== Changelog ==
36
37
= 3.0.3 (Dec. 3, 2012) =
38
* Bug fix: The default order for the 'author' taxonomy should be 'term_order', in order for the author positions to stick. Props [lgedeon](https://github.com/lgedeon)
39
@@ -82,11 +94,9 @@ Bug fixes and minor enhancements
82
* Bug fix: Allow output constants to be defined in a theme's functions.php file and include filters you can use instead
83
84
= 2.6.1 (Dec. 30, 2011) =
85
-
86
* Fix mangled usernames because of sanitize_key http://wordpress.org/support/topic/plugin-co-authors-plus-26-not-working-with-wp-33
87
88
= 2.6 (Dec. 22, 2011) =
89
-
90
* Sortable authors: Drag and drop the order of the authors as you'd like them to appear ([props kingkool68](http://profiles.wordpress.org/users/kingkool68/))
91
* Search for authors by display name (instead of nicename which was essentially the same as user_login)
92
* Option to remove the first author when there are two or more so it's less confusing
@@ -94,22 +104,18 @@ Bug fixes and minor enhancements
94
* Bug fix: Update the published post count for each user more reliably
95
96
= 2.5.3 (Aug. 14, 2011) =
97
-
98
* Bug fix: Removed extra comma when only two authors were listed. If you used the COAUTHORS_DEFAULT_BETWEEN_LAST constant, double-check what you have
99
100
= 2.5.2 (Apr. 23, 2011) =
101
-
102
* Bug: Couldn't query terms and authors at the same time (props nbaxley)
103
* Bug: Authors with empty fields (e.g. first name) were displaying blank in some cases
104
* Bug: authors with spaces in usernames not getting saved (props MLmsw, Ruben S. and others!)
105
* Bug: revisions getting wrong user attached (props cliquenoir!)
106
107
= 2.5.1 (Mar. 26, 2011) =
108
-
109
* Fix with author post count (throwing errors)
110
111
= 2.5 (Mar. 26, 2011) =
112
-
113
* Custom Post Type Support
114
* Compatibility with WP 3.0 and 3.1
115
* Gravatars
@@ -117,17 +123,14 @@ Bug fixes and minor enhancements
117
* Thanks to everyone who submitted bugs, fixes, and suggestions! And for your patience!
118
119
= 2.1.1 (Oct. 16, 2009) =
120
-
121
* Fix for coauthors not being added if their username is different from display name
122
* Fixes to readme.txt (fixes for textual and punctuation errors, language clarification, minor formatting changes) courtesy of [Waldo Jaquith](http://www.vqronline.org)
123
124
= 2.1 (Oct. 11, 2009) =
125
-
126
* Fixed issues related to localization. Thanks to Jan Zombik <zombik@students.uni-mainz.de> for the fixes.
127
* Added set_time_limit to update function to get around timeout issues when upgrading plugin
128
129
= 2.0 (Oct. 11, 2009) =
130
-
131
* Plugin mostly rewritten to make use of taxonomy instead of post_meta
132
* Can now see all authors of a post under the author column from Edit Posts page
133
* All authors of a post are now notified on a new comment
@@ -138,7 +141,6 @@ Bug fixes and minor enhancements
138
* FIX: Issues with coauthored posts not showing up on author archives
139
140
= 1.2.0 (Jun. 16, 2012) =
141
-
142
* FIX: Added compatibility for WordPress 2.8
143
* FIX: Added new template tags (get_the_coauthor_meta & the_coauthor_meta) to fix issues related to displaying author info on author archive pages. See [Other Notes](http://wordpress.org/extend/plugins/co-authors-plus/other_notes/) for details.
144
* FIX: Plugin should now work for plugins not using the 'wp_' DB prefix
@@ -147,34 +149,28 @@ Bug fixes and minor enhancements
147
* DOCS: Added details about the new template tags
148
149
= 1.1.5 (Apr. 26, 2009) =
150
-
151
* FIX: Not searching Updated SQL query for autosuggest to search through first name, last name, and nickname
152
* FIX: When editing an author, and clicking on a suggested author, the original author was not be removed
153
* DOCS: Added code comments to javascript; more still to be added
154
* DOCS: Updated readme information
155
156
= 1.1.4 (Apr. 25, 2009) =
157
-
158
* Disabled "New Author" output in suggest box, for now
159
* Hopefully fixed SVN issue (if you're having trouble with the plugin, please delete the plugin and reinstall)
160
161
= 1.1.3 (Apr. 23, 2009) =
162
-
163
* Add blur event to disable input box
164
* Limit only one edit at a time.
165
* Checked basic cross-browser compatibility (Firefox 3 OS X, Safari 3 OS X, IE7 Vista).
166
* Add suggest javascript plugin to Edit Page.
167
168
= 1.1.2 (Apr. 19, 2009) =
169
-
170
* Disabled form submit when enter pressed.
171
172
= 1.1.1 (Apr. 15, 2009) =
173
-
174
* Changed SQL query to return only contributor-level and above users.
175
176
= 1.1.0 (Apr. 14, 2009) =
177
-
178
* Initial beta release.
179
180
== Installation ==
@@ -186,5 +182,7 @@ Bug fixes and minor enhancements
186
1. Add co-authors to your posts and pages.
187
188
== Screenshots ==
189
- 1. "Authors" box with multiple authors added
190
- 2. Guest authors allow you to assign bylines without creating WordPress user accounts
1
=== Co-Authors Plus ===
2
Contributors: batmoo, danielbachhuber, automattic
3
Tags: authors, users, multiple authors, coauthors, multi-author, publishing
4
+ Tested up to: 3.5.1
5
Requires at least: 3.3
6
+ Stable tag: 3.0.4
7
8
Assign multiple bylines to posts, pages, and custom post types via a search-as-you-type input box
9
27
28
When a user is deleted from WordPress, they will be removed from all posts for which they are co-authors. If you chose to reassign their posts to another user, that user will be set as the coauthor instead.
29
30
+ = Can I use Co-Authors Plus with WordPress multisite? =
31
+
32
+ Yep! Co-Authors Plus can be activated on a site-by-site basis, or network-activated. If you create guest authors, however, those guest authors will exist on a site-by-site basis.
33
+
34
== Upgrade Notice ==
35
36
+ = 3.0.4 =
37
+ Bug fixes and the ability to automatically add co-authors to your feeds.
38
+
39
= 3.0.1 =
40
Bug fixes and minor enhancements
41
42
== Changelog ==
43
44
+ = 3.0.4 (Jan. 6, 2013) =
45
+ * Support for automatically adding co-authors to your feeds. Props [cfg](https://github.com/cfg).
46
+ * Bug fix: No Co-Authors Plus on attachments. For now.
47
+ * Bug fix: Better support for co-authors with non-standard user_nicenames. Props [STRML](https://github.com/STRML).
48
+
49
= 3.0.3 (Dec. 3, 2012) =
50
* Bug fix: The default order for the 'author' taxonomy should be 'term_order', in order for the author positions to stick. Props [lgedeon](https://github.com/lgedeon)
51
94
* Bug fix: Allow output constants to be defined in a theme's functions.php file and include filters you can use instead
95
96
= 2.6.1 (Dec. 30, 2011) =
97
* Fix mangled usernames because of sanitize_key http://wordpress.org/support/topic/plugin-co-authors-plus-26-not-working-with-wp-33
98
99
= 2.6 (Dec. 22, 2011) =
100
* Sortable authors: Drag and drop the order of the authors as you'd like them to appear ([props kingkool68](http://profiles.wordpress.org/users/kingkool68/))
101
* Search for authors by display name (instead of nicename which was essentially the same as user_login)
102
* Option to remove the first author when there are two or more so it's less confusing
104
* Bug fix: Update the published post count for each user more reliably
105
106
= 2.5.3 (Aug. 14, 2011) =
107
* Bug fix: Removed extra comma when only two authors were listed. If you used the COAUTHORS_DEFAULT_BETWEEN_LAST constant, double-check what you have
108
109
= 2.5.2 (Apr. 23, 2011) =
110
* Bug: Couldn't query terms and authors at the same time (props nbaxley)
111
* Bug: Authors with empty fields (e.g. first name) were displaying blank in some cases
112
* Bug: authors with spaces in usernames not getting saved (props MLmsw, Ruben S. and others!)
113
* Bug: revisions getting wrong user attached (props cliquenoir!)
114
115
= 2.5.1 (Mar. 26, 2011) =
116
* Fix with author post count (throwing errors)
117
118
= 2.5 (Mar. 26, 2011) =
119
* Custom Post Type Support
120
* Compatibility with WP 3.0 and 3.1
121
* Gravatars
123
* Thanks to everyone who submitted bugs, fixes, and suggestions! And for your patience!
124
125
= 2.1.1 (Oct. 16, 2009) =
126
* Fix for coauthors not being added if their username is different from display name
127
* Fixes to readme.txt (fixes for textual and punctuation errors, language clarification, minor formatting changes) courtesy of [Waldo Jaquith](http://www.vqronline.org)
128
129
= 2.1 (Oct. 11, 2009) =
130
* Fixed issues related to localization. Thanks to Jan Zombik <zombik@students.uni-mainz.de> for the fixes.
131
* Added set_time_limit to update function to get around timeout issues when upgrading plugin
132
133
= 2.0 (Oct. 11, 2009) =
134
* Plugin mostly rewritten to make use of taxonomy instead of post_meta
135
* Can now see all authors of a post under the author column from Edit Posts page
136
* All authors of a post are now notified on a new comment
141
* FIX: Issues with coauthored posts not showing up on author archives
142
143
= 1.2.0 (Jun. 16, 2012) =
144
* FIX: Added compatibility for WordPress 2.8
145
* FIX: Added new template tags (get_the_coauthor_meta & the_coauthor_meta) to fix issues related to displaying author info on author archive pages. See [Other Notes](http://wordpress.org/extend/plugins/co-authors-plus/other_notes/) for details.
146
* FIX: Plugin should now work for plugins not using the 'wp_' DB prefix
149
* DOCS: Added details about the new template tags
150
151
= 1.1.5 (Apr. 26, 2009) =
152
* FIX: Not searching Updated SQL query for autosuggest to search through first name, last name, and nickname
153
* FIX: When editing an author, and clicking on a suggested author, the original author was not be removed
154
* DOCS: Added code comments to javascript; more still to be added
155
* DOCS: Updated readme information
156
157
= 1.1.4 (Apr. 25, 2009) =
158
* Disabled "New Author" output in suggest box, for now
159
* Hopefully fixed SVN issue (if you're having trouble with the plugin, please delete the plugin and reinstall)
160
161
= 1.1.3 (Apr. 23, 2009) =
162
* Add blur event to disable input box
163
* Limit only one edit at a time.
164
* Checked basic cross-browser compatibility (Firefox 3 OS X, Safari 3 OS X, IE7 Vista).
165
* Add suggest javascript plugin to Edit Page.
166
167
= 1.1.2 (Apr. 19, 2009) =
168
* Disabled form submit when enter pressed.
169
170
= 1.1.1 (Apr. 15, 2009) =
171
* Changed SQL query to return only contributor-level and above users.
172
173
= 1.1.0 (Apr. 14, 2009) =
174
* Initial beta release.
175
176
== Installation ==
182
1. Add co-authors to your posts and pages.
183
184
== Screenshots ==
185
+
186
+ 1. Multiple authors can be added to a Post, Page, or Custom Post Type using an auto-complete interface.
187
+ 2. The order of your co-authors can be changed by drag and drop.
188
+ 3. Guest authors allow you to assign bylines without creating WordPress user accounts. You can also override existing WordPress account meta by mapping a guest author to a WordPress user.
screenshot-1.png CHANGED
Binary file
screenshot-2.png CHANGED
Binary file
screenshot-3.png ADDED
Binary file