Make WordPress Core


Ignore:
Timestamp:
04/24/2012 10:13:47 PM (12 years ago)
Author:
ryan
Message:
  • Return empty arrays instead of false for all conditions in get_blogs_of_user().
  • When deleting a user, use a delete_metadata_by_mid() loop over the meta so that the meta cache is cleared.
  • Use remove_user_from_blog() for DRYness.

Props nacin, duck_
Fixes #19500

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-admin/includes/ms.php

    r20522 r20581  
    161161    }
    162162
    163     $wpdb->delete( $wpdb->users, array( 'ID' => $id ) );
     163    $meta = $wpdb->get_col( $wpdb->prepare( "SELECT umeta_id FROM $wpdb->usermeta WHERE user_id = %d", $id ) );
     164    foreach ( $meta as $mid )
     165        delete_metadata_by_mid( 'user', $mid );
     166
    164167    $wpdb->delete( $wpdb->usermeta, array( 'user_id' => $id ) );
    165168
Note: See TracChangeset for help on using the changeset viewer.