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 authored and GaryJones committed Sep 2, 2023
1 parent da28669 commit b71ea29
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 @@ -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;
}
}

/**
Expand Down

0 comments on commit b71ea29

Please sign in to comment.