Co-Authors Plus - Version 2.6.3

Version Description

Download this release

Release Info

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

Code changes from version 2.6.2 to 2.6.3

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.6.2
7
  Author: Mohammad Jangda, Daniel Bachhuber, Automattic
8
  Copyright: 2008-2011 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', '2.6.2' );
28
 
29
  define( 'COAUTHORS_PLUS_PATH', dirname( __FILE__ ) );
30
  define( 'COAUTHORS_PLUS_URL', plugin_dir_url( __FILE__ ) );
@@ -48,10 +48,8 @@ class coauthors_plus {
48
  */
49
  function __construct() {
50
 
51
- $plugin_dir = dirname( plugin_basename( __FILE__ ) ) . '/languages/';
52
- load_plugin_textdomain( 'co-authors-plus', null, $plugin_dir );
53
 
54
-
55
  // Load admin_init function
56
  add_action( 'admin_init', array( $this,'admin_init' ) );
57
 
@@ -583,7 +581,7 @@ class coauthors_plus {
583
  $orderby = 'ORDER BY tr.term_order';
584
  $order = 'ASC';
585
  $object_ids = (int)$object_ids;
586
- $query = $wpdb->prepare( "SELECT t.slug, t.term_id FROM $wpdb->terms AS t INNER JOIN $wpdb->term_taxonomy AS tt ON tt.term_id = t.term_id INNER JOIN $wpdb->term_relationships AS tr ON tr.term_taxonomy_id = tt.term_taxonomy_id WHERE tt.taxonomy IN ($taxonomies) AND tr.object_id IN ($object_ids) $orderby $order" );
587
  $raw_coauthors = $wpdb->get_results( $query );
588
  $terms = array();
589
  foreach( $raw_coauthors as $author ) {
@@ -681,50 +679,41 @@ class coauthors_plus {
681
  */
682
  function search_authors( $search = '', $ignored_authors = array() ) {
683
 
684
- // Getting all of the users with one query style should allow us to cache it better
685
- $all_users = get_users( array( 'count_total' => false, 'fields' => 'all_with_meta' ) );
686
-
687
- // Go through all of the users associated with the site and see which match our query
688
- // We allow our search query to match against a number of fields
689
- $found_users = array();
690
- $search_fields = array(
691
- 'ID',
692
- 'display_name',
693
- 'first_name',
694
- 'last_name',
695
- 'nickname',
696
- 'user_email',
697
- 'user_login',
698
  );
699
- $search_fields = apply_filters( 'coauthors_edit_search_fields', $search_fields );
700
- foreach( $all_users as $blog_user ) {
701
-
702
- $search_results = array();
703
- foreach( $search_fields as $search_field ) {
704
- if ( false !== stripos( $blog_user->$search_field, $search ) )
705
- $search_results[$search_field] = true;
706
- else
707
- $search_results[$search_field] = false;
708
- }
709
- // Don't include the user if 0 of the search fields were true
710
- if ( !in_array( true, $search_results ) )
711
- continue;
712
-
713
- // Make sure the user is contributor and above (or a custom cap)
714
- if ( $blog_user->has_cap( apply_filters( 'coauthors_edit_author_cap', 'edit_posts' ) ) )
715
- $found_users[] = $blog_user;
716
-
717
- }
718
 
719
  // Allow users to always filter out certain users if needed (e.g. administrators)
720
  $ignored_authors = apply_filters( 'coauthors_edit_ignored_authors', $ignored_authors );
721
  foreach( $found_users as $key => $found_user ) {
 
722
  if ( in_array( $found_user->user_login, $ignored_authors ) )
723
  unset( $found_users[$key] );
 
 
724
  }
725
  return (array) $found_users;
726
  }
727
 
 
 
 
 
 
 
 
 
 
 
728
  /**
729
  * Functions to add scripts and css
730
  */
@@ -826,7 +815,11 @@ class coauthors_plus {
826
  return $allcaps;
827
 
828
  $post_type_object = get_post_type_object( $post->post_type );
829
-
 
 
 
 
830
  // Bail out if we're not asking about a post
831
  if ( ! in_array( $args[0], array( $post_type_object->cap->edit_post, $post_type_object->cap->edit_others_posts ) ) )
832
  return $allcaps;
@@ -836,7 +829,7 @@ class coauthors_plus {
836
  return $allcaps;
837
 
838
  // Bail out for users who can't publish posts if the post is already published
839
- if ( 'publish' == $post->post_status && ( ! isset( $allcaps[$post_type_object->cap->publish_posts] ) || ! $allcaps[$post_type_object->cap->publish_posts] ) )
840
  return $allcaps;
841
 
842
  // Finally, double check that the user is a coauthor of the post
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.6.3
7
  Author: Mohammad Jangda, Daniel Bachhuber, Automattic
8
  Copyright: 2008-2011 Shared and distributed between Mohammad Jangda, Daniel Bachhuber, Weston Ruter
9
 
24
 
25
  */
26
 
27
+ define( 'COAUTHORS_PLUS_VERSION', '2.6.3' );
28
 
29
  define( 'COAUTHORS_PLUS_PATH', dirname( __FILE__ ) );
30
  define( 'COAUTHORS_PLUS_URL', plugin_dir_url( __FILE__ ) );
48
  */
49
  function __construct() {
50
 
51
+ load_plugin_textdomain( 'co-authors-plus', null, dirname( plugin_basename( __FILE__ ) ) . '/languages/' );
 
52
 
 
53
  // Load admin_init function
54
  add_action( 'admin_init', array( $this,'admin_init' ) );
55
 
581
  $orderby = 'ORDER BY tr.term_order';
582
  $order = 'ASC';
583
  $object_ids = (int)$object_ids;
584
+ $query = $wpdb->prepare( "SELECT t.slug, t.term_id FROM $wpdb->terms AS t INNER JOIN $wpdb->term_taxonomy AS tt ON tt.term_id = t.term_id INNER JOIN $wpdb->term_relationships AS tr ON tr.term_taxonomy_id = tt.term_taxonomy_id WHERE tt.taxonomy IN (%s) AND tr.object_id IN (%s) $orderby $order", $taxonomies, $object_ids );
585
  $raw_coauthors = $wpdb->get_results( $query );
586
  $terms = array();
587
  foreach( $raw_coauthors as $author ) {
679
  */
680
  function search_authors( $search = '', $ignored_authors = array() ) {
681
 
682
+ $args = array(
683
+ 'count_total' => false,
684
+ 'search' => sprintf( '*%s*', $search ),
685
+ 'search_fields' => array(
686
+ 'ID',
687
+ 'display_name',
688
+ 'user_email',
689
+ 'user_login',
690
+ ),
691
+ 'fields' => 'all_with_meta',
 
 
 
 
692
  );
693
+ $found_users = get_users( $args );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
694
 
695
  // Allow users to always filter out certain users if needed (e.g. administrators)
696
  $ignored_authors = apply_filters( 'coauthors_edit_ignored_authors', $ignored_authors );
697
  foreach( $found_users as $key => $found_user ) {
698
+ // Make sure the user is contributor and above (or a custom cap)
699
  if ( in_array( $found_user->user_login, $ignored_authors ) )
700
  unset( $found_users[$key] );
701
+ else if ( false === $found_user->has_cap( apply_filters( 'coauthors_edit_author_cap', 'edit_posts' ) ) )
702
+ unset( $found_users[$key] );
703
  }
704
  return (array) $found_users;
705
  }
706
 
707
+ /**
708
+ * Modify get_users() to search display_name instead of user_nicename
709
+ */
710
+ function filter_pre_user_query( &$user_query ) {
711
+
712
+ if ( is_object( $user_query ) )
713
+ $user_query->query_where = str_replace( "user_nicename LIKE", "display_name LIKE", $user_query->query_where );
714
+ return $user_query;
715
+ }
716
+
717
  /**
718
  * Functions to add scripts and css
719
  */
815
  return $allcaps;
816
 
817
  $post_type_object = get_post_type_object( $post->post_type );
818
+
819
+ // Bail out if there's no post type object
820
+ if ( ! is_object( $post_type_object ) )
821
+ return $allcaps;
822
+
823
  // Bail out if we're not asking about a post
824
  if ( ! in_array( $args[0], array( $post_type_object->cap->edit_post, $post_type_object->cap->edit_others_posts ) ) )
825
  return $allcaps;
829
  return $allcaps;
830
 
831
  // Bail out for users who can't publish posts if the post is already published
832
+ if ( 'publish' == $post->post_status && ( ! isset( $allcaps[$post_type_object->cap->edit_published_posts] ) || ! $allcaps[$post_type_object->cap->edit_published_posts] ) )
833
  return $allcaps;
834
 
835
  // Finally, double check that the user is a coauthor of the post
languages/co-authors-plus-es_ES.mo ADDED
Binary file
languages/co-authors-plus-es_ES.po ADDED
@@ -0,0 +1,94 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Copyright (C) 2010 Co-Authors Plus
2
+ # This file is distributed under the same license as the Co-Authors Plus package.
3
+ msgid ""
4
+ msgstr ""
5
+ "Project-Id-Version: Co-Authors Plus 2.6.1\n"
6
+ "Report-Msgid-Bugs-To: http://wordpress.org/tag/co-authors-plus\n"
7
+ "POT-Creation-Date: 2011-12-30 05:00:31+00:00\n"
8
+ "MIME-Version: 1.0\n"
9
+ "Content-Type: text/plain; charset=UTF-8\n"
10
+ "Content-Transfer-Encoding: 8bit\n"
11
+ "PO-Revision-Date: 2012-03-12 01:24-0600\n"
12
+ "Last-Translator: AA\n"
13
+ "Language-Team: LANGUAGE es-ES <LL@li.org>\n"
14
+ "X-Poedit-Language: Spanish\n"
15
+ "X-Poedit-Country: Mexico\n"
16
+
17
+ #: co-authors-plus.php:39
18
+ msgid " and "
19
+ msgstr "y"
20
+
21
+ #: co-authors-plus.php:216
22
+ msgid "Post Authors"
23
+ msgstr "Autores de la entrada"
24
+
25
+ #: co-authors-plus.php:254
26
+ msgid "<strong>Note:</strong> To edit post authors, please enable javascript or use a javascript-capable browser"
27
+ msgstr "<strong>Nota:</strong> Para editar autores de la entrada, por favor habilite javascript o use un programa de consulta que soporte javascript"
28
+
29
+ #: co-authors-plus.php:261
30
+ #: co-authors-plus.php:743
31
+ msgid "Click on an author to change them. Drag to change their order. Click on <strong>Remove</strong> to remove them."
32
+ msgstr "Click en el autor para cambiarlo. Arrastrarlo para cambiar el orden. Click en <strong>Remover</strong> para eliminarlos."
33
+
34
+ #: co-authors-plus.php:291
35
+ msgid "Authors"
36
+ msgstr "Autores"
37
+
38
+ #: co-authors-plus.php:327
39
+ msgid "Posts"
40
+ msgstr "Entradas"
41
+
42
+ #: co-authors-plus.php:343
43
+ msgid "View posts by this author"
44
+ msgstr "Ver entradas por este autor"
45
+
46
+ #: co-authors-plus.php:738
47
+ msgid "Edit"
48
+ msgstr "Editar"
49
+
50
+ #: co-authors-plus.php:739
51
+ msgid "Remove"
52
+ msgstr "Remover"
53
+
54
+ #: co-authors-plus.php:740
55
+ msgid "Are you sure you want to remove this author?"
56
+ msgstr "¿Está seguro de remover este autor?"
57
+
58
+ #: co-authors-plus.php:741
59
+ msgid "Click to change this author, or drag to change their position"
60
+ msgstr "Click para cambiar este autor, o arrastrar para cambiar la posición"
61
+
62
+ #: co-authors-plus.php:742
63
+ msgid "Search for an author"
64
+ msgstr "Buscar un autor"
65
+
66
+ #: template-tags.php:71
67
+ msgid "No post ID provided for CoAuthorsIterator constructor. Are you not in a loop or is $post not set?"
68
+ msgstr "Sin ID de entrada para el contructor de CoAuthorsIterator. ¿no se encuentra en un loop o la entrada $post no está configurada?"
69
+
70
+ #: template-tags.php:189
71
+ #: template-tags.php:329
72
+ msgid "Posts by %s"
73
+ msgstr "Entradas por %s"
74
+
75
+ #: template-tags.php:230
76
+ msgid "Visit %s&#8217;s website"
77
+ msgstr "Visite el sitio web %s&#8217;s "
78
+
79
+ #. Plugin Name of the plugin/theme
80
+ msgid "Co-Authors Plus"
81
+ msgstr ""
82
+
83
+ #. Plugin URI of the plugin/theme
84
+ msgid "http://wordpress.org/extend/plugins/co-authors-plus/"
85
+ msgstr ""
86
+
87
+ #. Description of the plugin/theme
88
+ msgid "Allows multiple authors to be assigned to a post. This plugin is an extended version of the Co-Authors plugin developed by Weston Ruter."
89
+ msgstr "Permite que varios autores sean asignados a una entrada. Este plugin es una versión extendida del plugin Co-Authors desarrolada por Weston Ruter."
90
+
91
+ #. Author of the plugin/theme
92
+ msgid "Mohammad Jangda, Daniel Bachhuber"
93
+ msgstr ""
94
+
languages/co-authors-plus-fr_FR.mo ADDED
Binary file
languages/co-authors-plus-fr_FR.po ADDED
@@ -0,0 +1,92 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Copyright (C) 2010 Co-Authors Plus
2
+ # This file is distributed under the same license as the Co-Authors Plus package.
3
+ msgid ""
4
+ msgstr ""
5
+ "Project-Id-Version: Co-Authors Plus 2.6.1\n"
6
+ "Report-Msgid-Bugs-To: http://wordpress.org/tag/co-authors-plus\n"
7
+ "POT-Creation-Date: 2011-12-30 05:00:31+00:00\n"
8
+ "MIME-Version: 1.0\n"
9
+ "Content-Type: text/plain; charset=UTF-8\n"
10
+ "Content-Transfer-Encoding: 8bit\n"
11
+ "PO-Revision-Date: 2012-04-12 02:16-0500\n"
12
+ "Last-Translator: Sylvain Bérubé <sylvain.berube@gmail.com>\n"
13
+ "Language-Team: LANGUAGE <LL@li.org>\n"
14
+
15
+ #: co-authors-plus.php:39
16
+ msgid " and "
17
+ msgstr " et "
18
+
19
+ #: co-authors-plus.php:216
20
+ msgid "Post Authors"
21
+ msgstr "Auteurs de l'article"
22
+
23
+ #: co-authors-plus.php:254
24
+ msgid "<strong>Note:</strong> To edit post authors, please enable javascript or use a javascript-capable browser"
25
+ msgstr "<strong>Note:</strong> Pour éditer les auteurs d'un article, s'il vous plaît activer JavaScript ou utiliser un navigateur compatible à JavaScript"
26
+
27
+ #: co-authors-plus.php:261
28
+ #: co-authors-plus.php:743
29
+ msgid "Click on an author to change them. Drag to change their order. Click on <strong>Remove</strong> to remove them."
30
+ msgstr "Cliquer sur un auteur pour le modifier. Glisser-déposer pour en modifier l'ordre. Cliquer sur <strong>Retirer</strong> pour le retirer."
31
+
32
+ #: co-authors-plus.php:291
33
+ msgid "Authors"
34
+ msgstr "Auteurs"
35
+
36
+ #: co-authors-plus.php:327
37
+ msgid "Posts"
38
+ msgstr "Articles"
39
+
40
+ #: co-authors-plus.php:343
41
+ msgid "View posts by this author"
42
+ msgstr "Voir les articles de cet auteur"
43
+
44
+ #: co-authors-plus.php:738
45
+ msgid "Edit"
46
+ msgstr "Éditer"
47
+
48
+ #: co-authors-plus.php:739
49
+ msgid "Remove"
50
+ msgstr "Retirer"
51
+
52
+ #: co-authors-plus.php:740
53
+ msgid "Are you sure you want to remove this author?"
54
+ msgstr "Êtes-vous certain de vouloir retirer cet auteur?"
55
+
56
+ #: co-authors-plus.php:741
57
+ msgid "Click to change this author, or drag to change their position"
58
+ msgstr "Cliquer pour changer cet auteur, ou glisser-déposer pour modifier sa position"
59
+
60
+ #: co-authors-plus.php:742
61
+ msgid "Search for an author"
62
+ msgstr "Recherche d'un auteur"
63
+
64
+ #: template-tags.php:71
65
+ msgid "No post ID provided for CoAuthorsIterator constructor. Are you not in a loop or is $post not set?"
66
+ msgstr "Aucun ID d'article n'a été fourni au constructeur CoAuthorsIterator. Êtes-vous hors d'une «loop» ou est-ce que $post n'est pas défini?"
67
+
68
+ #: template-tags.php:189
69
+ #: template-tags.php:329
70
+ msgid "Posts by %s"
71
+ msgstr "Articles par %s"
72
+
73
+ #: template-tags.php:230
74
+ msgid "Visit %s&#8217;s website"
75
+ msgstr "Visiter le site de %s"
76
+
77
+ #. Plugin Name of the plugin/theme
78
+ msgid "Co-Authors Plus"
79
+ msgstr "Co-Authors Plus"
80
+
81
+ #. Plugin URI of the plugin/theme
82
+ msgid "http://wordpress.org/extend/plugins/co-authors-plus/"
83
+ msgstr "http://wordpress.org/extend/plugins/co-authors-plus/"
84
+
85
+ #. Description of the plugin/theme
86
+ msgid "Allows multiple authors to be assigned to a post. This plugin is an extended version of the Co-Authors plugin developed by Weston Ruter."
87
+ msgstr "Permettre à plusieurs auteurs d'être attribué à un article. Cet plugin est une version étendue du plugin Co-Authors développé par Weston Ruter."
88
+
89
+ #. Author of the plugin/theme
90
+ msgid "Mohammad Jangda, Daniel Bachhuber"
91
+ msgstr "Mohammad Jangda, Daniel Bachhuber"
92
+
languages/co-authors-plus.pot ADDED
@@ -0,0 +1,97 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Copyright (C) 2010 Co-Authors Plus
2
+ # This file is distributed under the same license as the Co-Authors Plus package.
3
+ msgid ""
4
+ msgstr ""
5
+ "Project-Id-Version: Co-Authors Plus 2.6.1\n"
6
+ "Report-Msgid-Bugs-To: http://wordpress.org/tag/co-authors-plus\n"
7
+ "POT-Creation-Date: 2011-12-30 05:00:31+00:00\n"
8
+ "MIME-Version: 1.0\n"
9
+ "Content-Type: text/plain; charset=UTF-8\n"
10
+ "Content-Transfer-Encoding: 8bit\n"
11
+ "PO-Revision-Date: 2010-MO-DA HO:MI+ZONE\n"
12
+ "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
13
+ "Language-Team: LANGUAGE <LL@li.org>\n"
14
+
15
+ #: co-authors-plus.php:39
16
+ msgid " and "
17
+ msgstr ""
18
+
19
+ #: co-authors-plus.php:216
20
+ msgid "Post Authors"
21
+ msgstr ""
22
+
23
+ #: co-authors-plus.php:254
24
+ msgid ""
25
+ "<strong>Note:</strong> To edit post authors, please enable javascript or use "
26
+ "a javascript-capable browser"
27
+ msgstr ""
28
+
29
+ #: co-authors-plus.php:261 co-authors-plus.php:743
30
+ msgid ""
31
+ "Click on an author to change them. Drag to change their order. Click on "
32
+ "<strong>Remove</strong> to remove them."
33
+ msgstr ""
34
+
35
+ #: co-authors-plus.php:291
36
+ msgid "Authors"
37
+ msgstr ""
38
+
39
+ #: co-authors-plus.php:327
40
+ msgid "Posts"
41
+ msgstr ""
42
+
43
+ #: co-authors-plus.php:343
44
+ msgid "View posts by this author"
45
+ msgstr ""
46
+
47
+ #: co-authors-plus.php:738
48
+ msgid "Edit"
49
+ msgstr ""
50
+
51
+ #: co-authors-plus.php:739
52
+ msgid "Remove"
53
+ msgstr ""
54
+
55
+ #: co-authors-plus.php:740
56
+ msgid "Are you sure you want to remove this author?"
57
+ msgstr ""
58
+
59
+ #: co-authors-plus.php:741
60
+ msgid "Click to change this author, or drag to change their position"
61
+ msgstr ""
62
+
63
+ #: co-authors-plus.php:742
64
+ msgid "Search for an author"
65
+ msgstr ""
66
+
67
+ #: template-tags.php:71
68
+ msgid ""
69
+ "No post ID provided for CoAuthorsIterator constructor. Are you not in a loop "
70
+ "or is $post not set?"
71
+ msgstr ""
72
+
73
+ #: template-tags.php:189 template-tags.php:329
74
+ msgid "Posts by %s"
75
+ msgstr ""
76
+
77
+ #: template-tags.php:230
78
+ msgid "Visit %s&#8217;s website"
79
+ msgstr ""
80
+
81
+ #. Plugin Name of the plugin/theme
82
+ msgid "Co-Authors Plus"
83
+ msgstr ""
84
+
85
+ #. Plugin URI of the plugin/theme
86
+ msgid "http://wordpress.org/extend/plugins/co-authors-plus/"
87
+ msgstr ""
88
+
89
+ #. Description of the plugin/theme
90
+ msgid ""
91
+ "Allows multiple authors to be assigned to a post. This plugin is an extended "
92
+ "version of the Co-Authors plugin developed by Weston Ruter."
93
+ msgstr ""
94
+
95
+ #. Author of the plugin/theme
96
+ msgid "Mohammad Jangda, Daniel Bachhuber"
97
+ msgstr ""
readme.txt CHANGED
@@ -2,15 +2,15 @@
2
  Contributors: batmoo, danielbachhuber, automattic
3
  Donate link: http://digitalize.ca/donate
4
  Tags: authors, users, multiple authors, coauthors, multi-author, publishing
5
- Tested up to: 3.3.1
6
  Requires at least: 3.1
7
- Stable tag: 2.6.2
8
 
9
  Allows multiple authors to be assigned to posts, pages, and custom post types via a search-as-you-type input box
10
 
11
  == Description ==
12
 
13
- Allows multiple authors to be assigned to posts, pagesges, or custom post types via the search-as-you-type inputs. Template tags allow listing of co-authors anywhere you'd normally list the author. Co-authored posts appear on a co-author's archive page and in their feed. 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 core behavior).
14
 
15
  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).
16
 
@@ -18,6 +18,12 @@ This plugin is an almost complete rewrite of the Co-Authors plugin originally de
18
 
19
  == Changelog ==
20
 
 
 
 
 
 
 
21
  = 2012-03-06 / 2.6.2 =
22
  * AJAX user search matches against first name, last name, and nickname fields too, in addition to display name, user login, and email address
23
  * Comment moderation and approved notifications are properly sent to all co-authors with the correct caps
2
  Contributors: batmoo, danielbachhuber, automattic
3
  Donate link: http://digitalize.ca/donate
4
  Tags: authors, users, multiple authors, coauthors, multi-author, publishing
5
+ Tested up to: 3.3.2
6
  Requires at least: 3.1
7
+ Stable tag: 2.6.3
8
 
9
  Allows multiple authors to be assigned to posts, pages, and custom post types via a search-as-you-type input box
10
 
11
  == Description ==
12
 
13
+ Allows multiple authors to be assigned to posts, pages, or custom post types via the search-as-you-type inputs. Template tags allow listing of co-authors anywhere you'd normally list the author. Co-authored posts appear on a co-author's archive page and in their feed. 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 core behavior).
14
 
15
  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).
16
 
18
 
19
  == Changelog ==
20
 
21
+ = 2012-03-06 / 2.6.3 =
22
+ * 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
23
+ * French translation courtesy of Sylvain Bérubé
24
+ * Spanish translation courtesy of Alejandro Arcos
25
+ * Bug fix: Resolved incorrect caps check against user editing an already published post. [See forum thread](http://wordpress.org/support/topic/multiple-authors-cant-edit-pages?replies=17#post-2741243)
26
+
27
  = 2012-03-06 / 2.6.2 =
28
  * AJAX user search matches against first name, last name, and nickname fields too, in addition to display name, user login, and email address
29
  * Comment moderation and approved notifications are properly sent to all co-authors with the correct caps
template-tags.php CHANGED
@@ -5,28 +5,32 @@ function get_coauthors( $post_id = 0, $args = array() ) {
5
 
6
  $coauthors = array();
7
  $post_id = (int)$post_id;
8
- if(!$post_id && $post_ID) $post_id = $post_ID;
9
- if(!$post_id && $post) $post_id = $post->ID;
 
 
10
 
11
  $defaults = array('orderby'=>'term_order', 'order'=>'ASC');
12
  $args = wp_parse_args( $args, $defaults );
13
 
14
- if($post_id) {
15
  $coauthor_terms = wp_get_post_terms( $post_id, $coauthors_plus->coauthor_taxonomy, $args );
16
 
17
- if(is_array($coauthor_terms) && !empty($coauthor_terms)) {
18
- foreach($coauthor_terms as $coauthor) {
19
  $post_author = get_user_by( 'login', $coauthor->name );
20
  // In case the user has been deleted while plugin was deactivated
21
- if(!empty($post_author)) $coauthors[] = $post_author;
 
22
  }
23
  } else {
24
- if($post) {
25
- $post_author = get_userdata($post->post_author);
26
  } else {
27
- $post_author = get_userdata($wpdb->get_var($wpdb->prepare("SELECT post_author FROM $wpdb->posts WHERE ID = %d", $post_id)));
28
  }
29
- if(!empty($post_author)) $coauthors[] = $post_author;
 
30
  }
31
  }
32
  return $coauthors;
@@ -40,17 +44,20 @@ function get_coauthors( $post_id = 0, $args = array() ) {
40
  function is_coauthor_for_post( $user, $post_id = 0 ) {
41
  global $post;
42
 
43
- if( ! $post_id && $post ) $post_id = $post->ID;
44
- if( ! $post_id ) return false;
 
 
45
 
46
  $coauthors = get_coauthors( $post_id );
47
- if( is_numeric( $user ) ) {
48
  $user = get_userdata( $user );
49
  $user = $user->user_login;
50
  }
51
 
52
  foreach( $coauthors as $coauthor ) {
53
- if( $user == $coauthor->user_login ) return true;
 
54
  }
55
  return false;
56
  }
@@ -62,16 +69,16 @@ class CoAuthorsIterator {
62
  var $authordata_array;
63
  var $count;
64
 
65
- function CoAuthorsIterator($postID = 0){
66
  global $post, $authordata, $wpdb;
67
  $postID = (int)$postID;
68
- if(!$postID && $post)
69
  $postID = (int)$post->ID;
70
- if(!$postID)
71
  trigger_error(__('No post ID provided for CoAuthorsIterator constructor. Are you not in a loop or is $post not set?', 'co-authors-plus')); //return null;
72
 
73
  $this->original_authordata = $this->current_author = $authordata;
74
- $this->authordata_array = get_coauthors($postID);
75
 
76
  $this->count = count($this->authordata_array);
77
  }
@@ -81,14 +88,14 @@ class CoAuthorsIterator {
81
  $this->position++;
82
 
83
  //At the end of the loop
84
- if($this->position > $this->count-1){
85
  $authordata = $this->current_author = $this->original_authordata;
86
  $this->position = -1;
87
  return false;
88
  }
89
 
90
  //At the beginning of the loop
91
- if($this->position == 0 && !empty($authordata))
92
  $this->original_authordata = $authordata;
93
 
94
  $authordata = $this->current_author = $this->authordata_array[$this->position];
@@ -97,7 +104,7 @@ class CoAuthorsIterator {
97
  }
98
 
99
  function get_position(){
100
- if($this->position === -1)
101
  return false;
102
  return $this->position;
103
  }
5
 
6
  $coauthors = array();
7
  $post_id = (int)$post_id;
8
+ if ( !$post_id && $post_ID )
9
+ $post_id = $post_ID;
10
+ if ( !$post_id && $post )
11
+ $post_id = $post->ID;
12
 
13
  $defaults = array('orderby'=>'term_order', 'order'=>'ASC');
14
  $args = wp_parse_args( $args, $defaults );
15
 
16
+ if ( $post_id ) {
17
  $coauthor_terms = wp_get_post_terms( $post_id, $coauthors_plus->coauthor_taxonomy, $args );
18
 
19
+ if ( is_array( $coauthor_terms ) && !empty( $coauthor_terms ) ) {
20
+ foreach( $coauthor_terms as $coauthor ) {
21
  $post_author = get_user_by( 'login', $coauthor->name );
22
  // In case the user has been deleted while plugin was deactivated
23
+ if ( !empty( $post_author ) )
24
+ $coauthors[] = $post_author;
25
  }
26
  } else {
27
+ if ( $post ) {
28
+ $post_author = get_userdata( $post->post_author );
29
  } else {
30
+ $post_author = get_userdata( $wpdb->get_var( $wpdb->prepare("SELECT post_author FROM $wpdb->posts WHERE ID = %d", $post_id ) ) );
31
  }
32
+ if ( !empty( $post_author ) )
33
+ $coauthors[] = $post_author;
34
  }
35
  }
36
  return $coauthors;
44
  function is_coauthor_for_post( $user, $post_id = 0 ) {
45
  global $post;
46
 
47
+ if( ! $post_id && $post )
48
+ $post_id = $post->ID;
49
+ if( ! $post_id )
50
+ return false;
51
 
52
  $coauthors = get_coauthors( $post_id );
53
+ if ( is_numeric( $user ) ) {
54
  $user = get_userdata( $user );
55
  $user = $user->user_login;
56
  }
57
 
58
  foreach( $coauthors as $coauthor ) {
59
+ if ( $user == $coauthor->user_login )
60
+ return true;
61
  }
62
  return false;
63
  }
69
  var $authordata_array;
70
  var $count;
71
 
72
+ function CoAuthorsIterator( $postID = 0 ){
73
  global $post, $authordata, $wpdb;
74
  $postID = (int)$postID;
75
+ if( !$postID && $post )
76
  $postID = (int)$post->ID;
77
+ if( !$postID )
78
  trigger_error(__('No post ID provided for CoAuthorsIterator constructor. Are you not in a loop or is $post not set?', 'co-authors-plus')); //return null;
79
 
80
  $this->original_authordata = $this->current_author = $authordata;
81
+ $this->authordata_array = get_coauthors( $postID );
82
 
83
  $this->count = count($this->authordata_array);
84
  }
88
  $this->position++;
89
 
90
  //At the end of the loop
91
+ if( $this->position > $this->count-1 ){
92
  $authordata = $this->current_author = $this->original_authordata;
93
  $this->position = -1;
94
  return false;
95
  }
96
 
97
  //At the beginning of the loop
98
+ if( $this->position == 0 && !empty( $authordata ) )
99
  $this->original_authordata = $authordata;
100
 
101
  $authordata = $this->current_author = $this->authordata_array[$this->position];
104
  }
105
 
106
  function get_position(){
107
+ if ( $this->position === -1 )
108
  return false;
109
  return $this->position;
110
  }