mirror of
https://github.com/WordPress/WordPress.git
synced 2024-11-12 13:44:21 +01:00
User deletion fixes. Props yoavf. fixes #13242
git-svn-id: http://svn.automattic.com/wordpress/trunk@14422 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
8c3476d90e
commit
dda59949de
@ -451,6 +451,8 @@ function wp_delete_user( $id, $reassign = 'novalue' ) {
|
|||||||
$wpdb->update( $wpdb->links, array('link_owner' => $reassign), array('link_owner' => $id) );
|
$wpdb->update( $wpdb->links, array('link_owner' => $reassign), array('link_owner' => $id) );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
clean_user_cache($id);
|
||||||
|
|
||||||
// FINALLY, delete user
|
// FINALLY, delete user
|
||||||
if ( !is_multisite() ) {
|
if ( !is_multisite() ) {
|
||||||
$wpdb->query( $wpdb->prepare("DELETE FROM $wpdb->usermeta WHERE user_id = %d", $id) );
|
$wpdb->query( $wpdb->prepare("DELETE FROM $wpdb->usermeta WHERE user_id = %d", $id) );
|
||||||
@ -460,8 +462,6 @@ function wp_delete_user( $id, $reassign = 'novalue' ) {
|
|||||||
$wpdb->query("DELETE FROM $wpdb->usermeta WHERE user_id = $id AND meta_key = '{$level_key}'");
|
$wpdb->query("DELETE FROM $wpdb->usermeta WHERE user_id = $id AND meta_key = '{$level_key}'");
|
||||||
}
|
}
|
||||||
|
|
||||||
clean_user_cache($id);
|
|
||||||
|
|
||||||
// allow for commit transaction
|
// allow for commit transaction
|
||||||
do_action('deleted_user', $id);
|
do_action('deleted_user', $id);
|
||||||
|
|
||||||
|
@ -102,6 +102,7 @@ case 'dodelete':
|
|||||||
case 'delete':
|
case 'delete':
|
||||||
if ( current_user_can('delete_user', $id) )
|
if ( current_user_can('delete_user', $id) )
|
||||||
wp_delete_user($id);
|
wp_delete_user($id);
|
||||||
|
break;
|
||||||
case 'reassign':
|
case 'reassign':
|
||||||
if ( current_user_can('delete_user', $id) )
|
if ( current_user_can('delete_user', $id) )
|
||||||
wp_delete_user($id, $_REQUEST['reassign_user']);
|
wp_delete_user($id, $_REQUEST['reassign_user']);
|
||||||
|
Loading…
Reference in New Issue
Block a user