From 5d95f79cd5ccd11b82e757c204443f068d66a891 Mon Sep 17 00:00:00 2001 From: Kata Date: Wed, 2 Aug 2023 11:42:23 -0400 Subject: [PATCH] Fix ajax_suggest user and guest author id collision --- co-authors-plus.php | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/co-authors-plus.php b/co-authors-plus.php index 3ea6cc68..4957e021 100755 --- a/co-authors-plus.php +++ b/co-authors-plus.php @@ -1277,6 +1277,11 @@ public function ajax_suggest() { } foreach ( $authors as $author ) { + $user_type = 'guest-user'; + if ( $author instanceof WP_User ) { + $user_type = 'wp-user'; + } + printf( "%s ∣ %s ∣ %s ∣ %s ∣ %s ∣ %s \n", esc_html( $author->ID ), @@ -1286,7 +1291,7 @@ public function ajax_suggest() { esc_html( str_replace( '∣', '|', $author->display_name ) ), esc_html( $author->user_email ), esc_html( rawurldecode( $author->user_nicename ) ), - esc_url( get_avatar_url( $author->ID ) ) + esc_url( get_avatar_url( $author->ID, array( 'user_type' => $user_type ) ) ) ); }