Co-Authors Plus 3.1: Manage co-authors from Quick Edit, misc improvements

Co-Authors Plus makes it possible to assign multiple bylines to posts, pages, and custom post types via a search-as-you-type meta box. Thanks to Mike Patek at Vocativ, version 3.1 includes co-author management via Quick Edit:

2014-03-17 at 3.48 PM

Also in this release:

  • Updated Spanish translation, courtesy of sergiomajluf.
  • Now matches core behavior when displaying author archive on multisite: user of the blog, or previously published author on the blog.
  • Breaking change: “Create Profile” link is no longer shown by default on the Manage Users screen. Instead, it can be enabled with the coauthors_show_create_profile_user_link filter.
  • Guest authors work properly with Jetpack Open Graph tags. Props hibernation.
  • Guest author profile editor now supports a few different fields. Props alpha1.
  • New coauthors_count_published_post_types filter for specifying the post type(s) used when calculating the user’s number of published posts.
  • Bug fix: Ensure post_author is set to one of the co-authors assigned to a post.
  • Bug fix: Filter author feed link for guest authors on the author page. Props hibernation.
  • Packages a composer.json file for those using Composer.
  • Beginnings of unit test coverage for core features. Increased minimum required WordPress version to 3.7 because WordPress.org unit testing framework doesn’t work reliabilty below that.

Please leave feedback, bug reports, and praise in the WordPress.org forums. You can also get involved with development on Github.

End of one era, on to the next

Automattic has claimed ownership of the plugins I worked on during my employment. As such, the VIP team and others will be taking responsibility for their continued development, maintenance, WordPress.org support, etc. Hopefully they remain independent and aren’t rolled into Jetpack. I’ll contribute as relevant to Human Made projects, but will no longer take an active role with the plugins.

These plugins include:

  • Edit Flow
  • Co-Authors Plus
  • Ad Code Manager
  • P2 Resolved Posts
  • Document Feedback
  • Rewrite Rules Inspector
  • Custom JavaScript Editor

Sometimes what appears to be a curse is actually a blessing in disguise. Human Made has pretty neat products in the works that I’m enjoying applying my creative energy towards. Stay tuned for that. And, on the open source side of things, I’ll have more time to contribute to wp-cli.

To everyone who’s used one of the above: it’s been a pleasure working with you. I’m looking forward to the opportunity to do so again in the future.

Co-Authors Plus v2.6.3: Enhancements and bug fixes

Co-Authors Plus makes it easy to add multiple bylines to a given post, and has full support for custom post types. Out just a moment ago, v2.6.3 has the following improvements:

  • AJAX user search is back to searching against first name, last name, display name, email address and user ID. The method introduced in v2.6.2 didn’t scale well across hundreds of users.
  • French translation courtesy of Sylvain Bérubé.
  • Spanish translation courtesy of Alejandro Arcos.
  • Bug fix: Resolved incorrect caps check against user editing an already published post. Thanks to Doug in the WordPress.org forums for the help.

Please post any questions, bug reports, feature requests, etc. in the WordPress.org forums. If you want to contribute code, I’m eyeballing co-author management in Quick Edit and guest author functionality for v2.7.

For WordPress.com VIPs, this update has already been deployed to the shared plugins repo.

Co-Authors Plus v2.6.2: Enhancements and bug fixes

Co-Authors Plus makes it easy to add multiple bylines to a given post, and has full support for custom post types. Out just a moment ago, v2.6.2 has the following improvements:

  • AJAX user search matches against first name, last name, and nickname fields too, in addition to display name, user login, and email address.
  • Comment moderation and approved notifications are properly sent to all co-authors with the correct capabilities.
  • Filter required capability for user to be returned in an AJAX search with ‘coauthors_edit_author_cap’. This defaults to ‘edit_posts’
  • Filter out administrators and other non-authors from AJAX search with ‘coauthors_edit_ignored_authors’
  • Automatically adds co-authors to Edit Flow’s story budget and calendar views.
  • Bug fix: Don’t set post_author value to current user when quick editing a post. This doesn’t appear in the UI anywhere, but added the post to the current user’s list of posts. See related forum conversation.
  • Bug fix: Properly cc other co-authors on new comment email notifications
  • Bug fix: If a user has already been added as an author to a post, don’t show them in the AJAX search again.
  • Bug fix: Allow output constants to be defined in a theme’s functions.php file and include filters you can use instead.

Please post any questions, bug reports, feature requests, etc. in the WordPress.org forums. If you want to contribute code, I’m eyeballing co-author management in Quick Edit and guest author functionality for v2.7.

For WordPress.com VIPs, this update has already been deployed to the shared plugins repo.

Allowing authors to set co-authors

In the WordPress.org forums, whoaloic asks:

I have a site with multiple authors.
I would like to allow authors who create a post or a page to give rights to other authors.
For now, only administrator and editor can do that.
Is there a solution?

Yep, totally doable. By default, Co-Authors Plus defaults to ‘edit_others_posts’ as the required cap for changing co-authors. With the following code snippet in your theme’s functions.php file, you can make that cap ‘publish_posts’ instead (which authors and above usually have).

[sourcecode language=”php”]
/**
* Filter the Co-Authors Plus current_user_can_set_authors() function
* so that users with ‘publish_posts’ can set Co-Authors
*
* @author danielbachhuber
*
* @see https://github.com/danielbachhuber/Co-Authors-Plus/issues/8
* @see http://wordpress.org/support/topic/plugin-co-authors-plus-allow-authors-post-to-give-access-to-other-authors
*/
add_filter( ‘coauthors_plus_edit_authors’, ‘db_filter_coauthors_edit_cap’ );
function db_filter_coauthors_edit_cap( $cap_result ) {
global $coauthors_plus;

$post_type = $coauthors_plus->get_current_post_type();
if( ! $post_type ) return false;

$post_type_object = get_post_type_object( $post_type );
return current_user_can( $post_type_object->cap->publish_posts );
}
[/sourcecode]

In preparing this snippet, I also opened a couple of issues in Github:

Show biographies for co-authors at the end of your post

In the WordPress.org forums, doubleedesign says:

I want to add the authors’ biographies to the end of each post.

Awesome… it’s pretty simple to do. Conceptually, what we need to do is load our co-authors, and then loop through printing the relevant information for each one.

You’ll want to put the following code snippet within The Loop in any template you’d like the bios to appear.

[sourcecode language=”php”]
/**
* Show multiple Co-Author biography fields at the bottom of a single post
* This snippet should be placed within The Loop
*/
if ( class_exists( ‘coauthors_plus’ ) ) {
// Get the Co-Authors for the post
$co_authors = get_coauthors();
// For each Co-Author, echo a wrapper div, their name, and their bio if they have one
foreach ( $co_authors as $key => $co_author ) {
$co_author_classes = array(
‘co-author-wrap’,
‘co-author-number-‘ . ( $key + 1 ),
);
echo ‘<div class="’ . implode( ‘ ‘, $co_author_classes ) . ‘">';
echo ‘<h4 class="co-author-display-name">’ . $co_author->display_name . ‘</h4>';
// Only print the description if the description exists
if ( $description = get_the_author_meta( ‘description’, $co_author->ID ) )
echo ‘<p class="co-author-bio">’ . $description . ‘</p>';
echo ‘</div>';
}
}
[/sourcecode]

If you’d like other co-author details to appear as well, like their avatar for instance, you can modify the output within the foreach loop.

Co-Authors Plus v2.6: Search user’s display names, change byline order and more

Co-Authors Plus makes it easy to add multiple bylines to a given post, and has full support for custom post types. Out this evening, v2.6 has the following improvements:

  • Sortable authors — drag and drop the order of the authors as you’d like them to appear
  • Search for authors by display name so you can easily add bylines by first or last name
  • Option to remove the first author when there are two or more listed
  • More reliably generates the published post count for each user

Thanks to those in the forum who provided feedback and special thanks to Russell Heimlich for his contributions with sortable authors. If you feel like giving back, there are a few tickets open we’d love patches for. In particular, guest bylines would be pretty neat. I have a possible direction you can go if you’re looking for inspiration.

For our WordPress.com VIPs, this release will be available in the shared plugins directory in just a moment.

Co-authors in your RSS feeds

In the WordPress.org forums, razorfrog asks:

Short of editing core WordPress code, is it possible to display the multiple authors in the site’s RSS feed?

Of course there is! From the source code, we know the RSS feed template uses the_author() to display the post’s byline information. Furthermore, the_author() echoes get_the_author() which is a filterable function. Filters allow us to programmatically change values used in a function. What we need to do is write a short snippet to produce the co-authors byline when an RSS feed is requested and Co-Authors Plus is activated.

The snippet is as follows, and can be placed in your theme’s functions.php file or a standalone MU plugin.

[sourcecode lang=”php”]/**
* Co-authors in RSS and other feeds
* /wp-includes/feed-rss2.php uses the_author(), so we selectively filter the_author value
*/
function db_coauthors_in_rss( $the_author ) {

if ( !is_feed() || !function_exists( ‘coauthors’ ) )
return $the_author;

return coauthors( null, null, null, null, false );
}
add_filter( ‘the_author’, ‘db_coauthors_in_rss’ );[/sourcecode]