Opened 12 years ago
Last modified 6 years ago
#21910 new enhancement
wpmu_create_user() standardization
Reported by: | ryanduff | Owned by: | |
---|---|---|---|
Milestone: | Priority: | normal | |
Severity: | normal | Version: | 3.0 |
Component: | Users | Keywords: | needs-patch |
Focuses: | multisite | Cc: |
Description
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.
Change History (6)
#3
@
12 years ago
Thanks Sergey for fixing the version. I always forget that. Wish we could get it changed to "Earliest Version"
As far as depreciating... that's fine. Perhaps roll all of wpmu_create_user() into wp_insert_user() since that's what does most of the heavy lifting? The only real difference is that the former deletes roles/caps until they're assigned to a site. Maybe we can just check if it's a network install and if so do that within wp_insert_user()?
Any other suggestions?
All the more reason to deprecate it.