[wp-trac] [WordPress Trac] #40030: Pass User and Comment Objects to rest_get_avatar_urls

WordPress Trac noreply at wordpress.org
Sat Mar 4 04:10:43 UTC 2017


#40030: Pass User and Comment Objects to rest_get_avatar_urls
--------------------------+-----------------------------
 Reporter:  dshanske      |      Owner:
     Type:  defect (bug)  |     Status:  new
 Priority:  normal        |  Milestone:  Awaiting Review
Component:  REST API      |    Version:  4.4
 Severity:  normal        |   Keywords:
  Focuses:                |
--------------------------+-----------------------------
 This function retrieves avatars based on email address. It is used by the
 comments and user controllers.

 However, this means that we are locking ourselves into Gravatar, which is
 a whole other conversation.

 The dependent Comment and User 'prepare_item_for_response' functions pass
 the email address from a User Object or Comment Object to the
 rest_get_avatar_urls function.

 Instead, they should pass the entire Comment or User object. Since
 get_avatar_url supports this, it will result in no backward compatibility
 issues, and this will allow the objects to be filtered using existing
 filters, assuming that you wanted to return alternative avatar data, such
 as a local avatar, alternative remote service, what have you.

 Since this is internal to Core, it won't result in any data leakage to the
 API.

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


More information about the wp-trac mailing list