Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Retrieving avatar fails when using WP_Post #20

Closed
blobaugh opened this issue Mar 5, 2019 · 2 comments · Fixed by #47
Closed

Retrieving avatar fails when using WP_Post #20

blobaugh opened this issue Mar 5, 2019 · 2 comments · Fixed by #47
Assignees
Labels
type:bug Something isn’t working.
Milestone

Comments

@blobaugh
Copy link

blobaugh commented Mar 5, 2019

When calling get_avatar() and passing in a WP_Post object Simple Local Avatars fails to properly pick up the user id. This is because the core get_avatar() supports more methods of finding the user id than the plugin's get_avatar().

Example code (where $post is the global on a single view):
$avatar = get_avatar( $post, '72' )

You can see all the types supported by core at
https://github.com/WordPress/WordPress/blob/master/wp-includes/link-template.php#L4091

  • Number
  • String
  • WP_User
  • WP_Post
  • WP_Comment

Support in the plugins is at
https://github.com/10up/simple-local-avatars/blob/develop/simple-local-avatars.php#L66

  • Number
  • String
  • Generic object with post_id property
@jeffpaul
Copy link
Member

jeffpaul commented Mar 5, 2019

@blobaugh thanks for the feedback, it's much appreciated! I'm tentatively adding this to our 2.2 milestone, but note we don't have a timeline on that yet as its unplanned. If you're able to work on a Pull Request, that would be welcomed. Otherwise, we'll look into reviewing this and any possible resolution.

@jeffpaul jeffpaul added this to the 2.2 milestone Mar 5, 2019
@jeffpaul jeffpaul added the type:bug Something isn’t working. label Mar 5, 2019
@oscarssanchez
Copy link
Contributor

Hey @blobaugh ,

I made PR #47 for this, can you test this works for you ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type:bug Something isn’t working.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants