From b71ea29f48cb91c0270bf6202970d98f7f81e28b Mon Sep 17 00:00:00 2001 From: Eddie Carrasco Date: Wed, 30 Aug 2023 20:48:11 -0400 Subject: [PATCH] fix: returning a plain WP_User if guest authors is not enabled. 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. --- co-authors-plus.php | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/co-authors-plus.php b/co-authors-plus.php index d9520742..be0aa917 100755 --- a/co-authors-plus.php +++ b/co-authors-plus.php @@ -334,9 +334,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; + } } /**