[wp-trac] [WordPress Trac] #21910: wpmu_create_user() standardization

WordPress Trac wp-trac at lists.automattic.com
Mon Sep 17 18:03:24 UTC 2012


#21910: wpmu_create_user() standardization
-----------------------------+--------------------------
 Reporter:  ryanduff         |       Type:  defect (bug)
   Status:  new              |   Priority:  normal
Milestone:  Awaiting Review  |  Component:  Multisite
  Version:  trunk            |   Severity:  minor
 Keywords:  needs-patch      |
-----------------------------+--------------------------
 There seems to be some inconsistencies between wpmu_create_user(),
 create_user(), and wp_insert_user(). The former two are wrappers, and do
 different things but potential to consolidate and clean up some old code.

 Per Nacin:
 >nacin: wpmu_create_user() should probably just go away.

 >nacin: fairly useless function

 >nacin: by default, it looks like wp_insert_user() would create a role-
 less user.

 >nacin: as would wp_create_user()

 Looking at wp_insert_user() it sets the default role if none is provided,
 where wpmu_create_user() would actually delete the default roles and caps.

 Although, I'm not really sure there's a use case where you'd be using both
 the wpmu_new_user and user_register hooks simultaneously so possibly
 depreciate the former in favor of the latter.

 One real issue with wpmu_create_user is that it returns false instead of
 the WP_Error object which is probably not desired since the error could be
 useful. The false return is used in wpmu_activate_signup() to either set
 the returned ID or create it's own WP_Error.

 Lastly... documentation for create_user says it returns the ID, but it
 looks like it could potentially also return a WP_Error object. Didn't
 test, but possible documentation fix there.

-- 
Ticket URL: <http://core.trac.wordpress.org/ticket/21910>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software


More information about the wp-trac mailing list