=== Co-Authors Plus === Contributors: batmoo, danielbachhuber Donate link: http://digitalize.ca/donate Tags: authors, users, multiple authors, coauthors, multi-author Tested up to: 3.2.1 Requires at least: 3.0 Stable tag: 2.5.3 Allows multiple authors to be assigned to a Posts via search-as-you-type input boxes. == Description == Allows multiple authors to be assigned to a Post, Pages, or Custom Post Types via the search-as-you-type inputs. Co-authored posts appear on a co-author's posts page and feed. New template tags allow listing of co-authors. Editors and Administrators may assign co-authors to a post. Additionally, co-authors may edit the posts they are associated with, and co-authors who are contributors may only edit posts if they have not been published (as is usual). This plugin is an almost complete rewrite of the Co-Authors plugin originally developed at [Shepherd Interactive](http://www.shepherd-interactive.com/) (2007). The original plugin was inspired by the 'Multiple Authors' plugin by Mark Jaquith (2005). The extended version incorporates search-as-you-type functionality for adding users, which aims to make easy the task of adding multiple users to posts and pages, especially when dealing with a system with hundreds of users (typical of newspaper and magazine sites). > *See "Other Notes" section for Template Tags and usage information* == Changelog == = 2011-08-14 / 2.5.3 = * 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 = 2011-04-23 / 2.5.2 = * Bug: Couldn't query terms and authors at the same time (props nbaxley) * Bug: Authors with empty fields (e.g. first name) were displaying blank in some cases * Bug: authors with spaces in usernames not getting saved (props MLmsw, Ruben S. and others!) * Bug: revisions getting wrong user attached (props cliquenoir!) = 2011-03-26 / 2.5.1 = * Fix with author post count (throwing errors) = 2011-03-26 / 2.5 = * Custom Post Type Support * Compatibility with WP 3.0 and 3.1 * Gravatars * Lots and lots and lots of bug fixes * Thanks to everyone who submitted bugs, fixes, and suggestions! And for your patience! = 2009-10-16 / 2.1.1 = * Fix for coauthors not being added if their username is different from display name * Fixes to readme.txt (fixes for textual and punctuation errors, language clarification, minor formatting changes) courtesy of [Waldo Jaquith](http://www.vqronline.org) = 2009-10-11 / 2.1 = * Fixed issues related to localization. Thanks to Jan Zombik for the fixes. * Added set_time_limit to update function to get around timeout issues when upgrading plugin = 2009-10-11 / 2.0 = * Plugin mostly rewritten to make use of taxonomy instead of post_meta * Can now see all authors of a post under the author column from Edit Posts page * All authors of a post are now notified on a new comment * Various javascript enhancements * New option to allow subscribers to be added as authors * All Authors can edit they posts of which they are coauthors * FIX: Issues with wp_coauthors_list function * FIX: Issues with coauthored posts not showing up on author archives = 2009-06-16 / 1.2.0 = * FIX: Added compatibility for WordPress 2.8 * 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. * FIX: Plugin should now work for plugins not using the 'wp_' DB prefix * FIX: Coauthors should no longer be alphabetically reordered when the post is updated * FIX: Plugin now used WordPress native AJAX calls to tighten security * DOCS: Added details about the new template tags = 2009-04-26 / 1.1.5 = * FIX: Not searching Updated SQL query for autosuggest to search through first name, last name, and nickname * FIX: When editing an author, and clicking on a suggested author, the original author was not be removed * DOCS: Added code comments to javascript; more still to be added * DOCS: Updated readme information = 2009-04-25 / 1.1.4 = * Disabled "New Author" output in suggest box, for now * Hopefully fixed SVN issue (if you're having trouble with the plugin, please delete the plugin and reinstall) = 2009-04-23 / 1.1.3 = * Add blur event to disable input box * Limit only one edit at a time. * Checked basic cross-browser compatibility (Firefox 3 OS X, Safari 3 OS X, IE7 Vista). * Add suggest javascript plugin to Edit Page. = 2009-04-19 / 1.1.2 = * Disabled form submit when enter pressed. = 2009-04-15 / 1.1.1 = * Changed SQL query to return only contributor-level and above users. = 2009-04-14: 1.1.0 = * Initial beta release. == Installation == 1. IMPORTANT: Please disable the original Co-Authors plugin (if you are using it) before installing Co-Authors Plus 1. Extract the coauthors-plus.zip file and upload its contents to the `/wp-content/plugins/` directory. Alternately, you can install directly from the Plugin directory within your WordPress Install. 1. Activate the plugin through the "Plugins" menu in WordPress. 1. Place the appropriate coauthors template tags in your template. 1. Add co-authors to your posts and pages. == Basic Usage and Other Notes == * Contributor-level and above can be added as co-authors. An option added as of 2.0 allows subscribers to be added as coauthors as well. * As per WordPress design, only Editor-level and above users can change Post Authors. Authors cannot change authors or add co-authors (yet). * As per WordPress design, when an editor creates a new Post or Page, they are by default added as an author. However, they can be replaced by clicking on their name and typing in the name of the new author. * The search-as-you-type box starts searching once two letters have been added, and executes a new search with every subsequent letter. * The search-as-you-type box searches through the following user fields: a) user login; b) user nicename; c) display name; d) user email; e) first name; f) last name; and g) nickname. == Template Tags == New template tags enable listing of co-authors: * coauthors() * coauthors_posts_links() * coauthors_firstnames() * coauthors_lastnames() * coauthors_nicknames() * coauthors_links() * coauthors_IDs() These template tags correspond to their "the_author*" equivalents; take special note of the pluralization. Each of these template tags accept four optional arguments: 1. between: default ", " 1. betweenLast: default " and " 1. before: default "" 1. after: default "" To use them, simply modify the code surrounding all instances of the_author*() to something like the following example: if(function_exists('coauthors_posts_links')) coauthors_posts_links(); else the_author_posts_link(); The result of this would be formatted like "John Smith, Jane Doe and Joe Public". Note that as of this writing, WordPress does provide a means of extending wp_list_authors(), so included in this plugin is the function coauthors_wp_list_authors() modified to take into account co-authored posts; the same arguments are accepted. Sometimes you may need fine-grained control over the display of a posts's authors, and in this case you may use the CoAuthorsIterator class. This class may be instantiated anywhere you may place the_author() or everywhere if the post ID is provided to the constructor. The instantiated class has the following methods: 1. iterate(): advances $authordata to the next co-author; returns false and restores the original $authordata if there are no more authors to iterate. 1. get_position(): returns the zero-based index of the current author; returns -1 if the iterator is invalid. 1. is_last(): returns true if the current author is the last. 1. is_first(): returns true if the current author is the first. 1. count(): returns the total number of authors. 1. get_all(): returns an array of all of the authors' user data. For example: $i = new CoAuthorsIterator(); print $i->count() == 1 ? 'Author: ' : 'Authors: '; $i->iterate(); the_author(); while($i->iterate()){ print $i->is_last() ? ' and ' : ', '; the_author(); } = the coauthor meta = * get_the_coauthor_meta( $field ) (2.8 only) * the_coauthor_meta( $field ) (2.8 only) Note: The $field variable corresponds with the same values accepted by the [the author meta](http://codex.wordpress.org/Template_Tags/the_author_meta) function. = get coauthors = * get_coauthors( [$post_id], [$args] ) This function returns an array of coauthors for the specified post, or if used inside the Loop, the current post active in the Loop. the $args parameter is an array that allows you to specify the order in which the authors should be returned. = is coauthor for post = * is_coauthor_for_post( $user, $post_id ) This function allows you to check whether the specified user is coauthor for a post. The $user attribute can be the user ID or username. == Frequently Asked Questions == = What is the main difference between Co-Authors and Co-Authors Plus? = The most notable difference is the replacement of the standard WordPress authors drop-downs with search-as-you-type/auto-suggest/whatever-you-call-them input boxes. As a result, major bits of the JavaScript code was changed to be more jQuery-friendly. Eventually, I hope to include the ability to add new Users from within the Edit Post/Page screen and possibly Gravatar support. = What happens to posts and pages when I delete a user assigned to a post or page as a coauthor? = 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. == Screenshots == 1. "Post Author(s)" box with multiple authors added 2. Search-as-you-type input box that looks up authors as you type in their name. Fields displayed are: ID, Display Name, and Email.