Opened 9 years ago
Last modified 5 years ago
#32796 new enhancement
User deletion API is inconsistent between MS and non-MS
Reported by: | boonebgorges | Owned by: | |
---|---|---|---|
Milestone: | Priority: | normal | |
Severity: | normal | Version: | |
Component: | Users | Keywords: | needs-unit-tests has-patch |
Focuses: | multisite | Cc: |
Description
On non-multisite, wp_delete_user( $u )
does what you'd expect: it deletes user $u
from the database. On multisite, the same function basically wraps remove_user_from_blog()
; if you want to delete a user from the database altogether, you've got to use wpmu_delete_user()
.
I understand the historical reasons behind the divergence, but it's pretty lame from a developer's point of view to have to check is_multisite()
before removing a user from the database.
There's a note in the docblock for wpmu_delete_user()
that says * @todo Merge with wp_delete_user() ?
. Maybe we could actually make this happen?
Attachments (1)
Change History (3)
#2
@
9 years ago
- Keywords has-patch added; needs-patch removed
32796.diff is a first attempt at a merge of wpmu_delete_user()
into wp_delete_user()
.
It's not as bad as I thought it would be so far, though a full suite of tests to go along with this will be nice. I have not done any extensive testing, but it passes our current (limited) tests and I'm able to do basic things as expected.
Notes:
- I've added a
$context
parameter towp_delete_user()
so that we can determine if a user is being deleted from a network or from an individual site on the network. Single site should always be in the site context. - It's worth looking at #12720 as part of this ticket. @danielbachhuber's comment about explicit core APIs makes sense. There could be room for something like
wp_reassign_user_content()
andwp_delete_user_content()
here.
In 32953: