[wp-trac] [WordPress Trac] #22921: Allow get_users() to return array of values via 'fields' parameter

WordPress Trac noreply at wordpress.org
Mon Jun 16 15:56:11 UTC 2014


#22921: Allow get_users() to return array of values via 'fields' parameter
-------------------------------------------------+-------------------------
 Reporter:  chipbennett                          |       Owner:
     Type:  enhancement                          |      Status:  new
 Priority:  normal                               |   Milestone:  Future
Component:  Users                                |  Release
 Severity:  normal                               |     Version:  3.5
 Keywords:  has-patch needs-testing dev-         |  Resolution:
  feedback                                       |     Focuses:
-------------------------------------------------+-------------------------

Comment (by chipbennett):

 Replying to [comment:15 DrewAPicture]:
 > As for the purpose of the ticket, the patch as-is would constitute a
 breaking change. I think we need a lot more data on whether plugin devs
 are using the `fields` argument in this way, if so how many and how. We
 also need to determine whether that usage constitutes "doing it wrong" as
 we've unfortunately been pigeon-holing all individual fields as 'ID' this
 whole time.

 Theoretical issues should not constitute blockers for improvement. Are
 there any live, real-world examples of Plugins for which this patch would
 cause breakage? If so, your assessment may have merit. Even so, I refer
 you back to @dd32's
 [https://core.trac.wordpress.org/ticket/22921?replyto=15#comment:4
 comment] above:

 > If you take a look at the patch, the only code that will break, are
 those passing the fields parameter as one of the following, and expecting
 back a list of user_id's, a broken assumption and code to start with.
 {{{
 array( 'ID', 'user_login', 'user_pass', 'user_nicename', 'user_email',
 'user_url', 'user_registered', 'user_activation_key', 'user_status',
 'display_name' )
 }}}

 I would agree with @dd32, and would argue that such breakage would indeed
 constitute `_doing_it_wrong()`. Querying for e.g. `'user_email'` should
 not reasonably be expected to return `'ID'`.

 Changing the parameters, or the output, of the function would almost
 certainly be overkill here, and would potentially introduce far more
 compatibility/breakage issues than would the proposed patch.

--
Ticket URL: <https://core.trac.wordpress.org/ticket/22921#comment:16>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list