Skip to content

Commit

Permalink
fix: returning a plain WP_User if guest authors is not enabled.
Browse files Browse the repository at this point in the history
I forgot to run tests on my previous commit. This satisfies the test Test_CoAuthors_Plus::test_get_coauthor_by_when_guest_authors_not_enabled which is expecting a WP_User when the plugin is not enabled.
  • Loading branch information
eddiesshop committed Aug 31, 2023
1 parent 0f885ab commit af2fadc
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions co-authors-plus.php
Original file line number Diff line number Diff line change
Expand Up @@ -345,9 +345,17 @@ public function get_coauthor_by( $key, $value, $force = false ) {

return $user;
}
}
} else {
$user = $this->get_user_by( $key, $value );

return false;
if ( is_null( $user ) ) {
return false;
}

$user->type = 'wpuser';

return $user;
}
}

/**
Expand Down

0 comments on commit af2fadc

Please sign in to comment.