[wp-trac] [WordPress Trac] #41544: $id_or_email parameter in get_avatar filter needs to be more concrete

WordPress Trac noreply at wordpress.org
Thu Aug 3 10:16:04 UTC 2017


#41544: $id_or_email parameter in get_avatar filter needs to be more concrete
----------------------------+-----------------------------
 Reporter:  dikiy_forester  |      Owner:
     Type:  enhancement     |     Status:  new
 Priority:  normal          |  Milestone:  Awaiting Review
Component:  Users           |    Version:  trunk
 Severity:  normal          |   Keywords:
  Focuses:                  |
----------------------------+-----------------------------
 In the {{{get_avatar}}} and {{{pre_get_avatar}}} filters there is a
 parameter {{{$id_or_email}}} which documented as:

 > The Gravatar to retrieve. Accepts a user_id, gravatar md5 hash, user
 email, WP_User object, WP_Post object, or WP_Comment object.

 There might be anything, but how to get user from it?

 So, in filter callback function, developer have to check all of these
 types to determine the actual user identifier.

 Like here https://core.trac.wordpress.org/browser/tags/4.8.1/src/wp-
 includes/link-template.php?rev=41211#L3923-L3965

 Would be much more better to have more concrete value type in
 {{{$id_or_email}}} parameter (for example user ID) passed to
 {{{get_avatar}}} and {{{pre_get_avatar}}} filters. Really.

--
Ticket URL: <https://core.trac.wordpress.org/ticket/41544>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list