Skip to content

Commit

Permalink
Fix ajax_suggest user and guest author id collision
Browse files Browse the repository at this point in the history
  • Loading branch information
katag9k authored Aug 2, 2023
1 parent 8a7de62 commit 5d95f79
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion co-authors-plus.php
Original file line number Diff line number Diff line change
Expand Up @@ -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 ),
Expand All @@ -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 ) ) )
);
}

Expand Down

0 comments on commit 5d95f79

Please sign in to comment.