Skip to content

Commit

Permalink
Merge pull request #13 from abij/patch-2
Browse files Browse the repository at this point in the history
Add context "edit" when listing users to retrieve email field.
  • Loading branch information
mvanholsteijn authored Jan 16, 2025
2 parents 8c5ddb6 + 2f2a006 commit 55990d0
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/wordpress_markdown_blog_loader/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -331,7 +331,9 @@ def get_unique_user_by_name(self, name: str, email: Optional[str]) -> "User":

users = []
try:
users = self.users({"search": name})
# The email field is only returned when the context edit is passed.
# See: https://developer.wordpress.org/rest-api/reference/users/
users = self.users({"search": name, "context": "edit"})
except PermissionDenied as error:
logging.error("You have no permission to search for other users.\n Make sure your author name '%s' matches your WP display name '%s' or visa versa", name, user.name)
exit(1)
Expand Down

0 comments on commit 55990d0

Please sign in to comment.