WordPress.org

Make WordPress Core


Ignore:
Timestamp:
03/24/2012 03:24:31 PM (8 years ago)
Author:
nacin
Message:

Introduce $wpdb->delete(). props justindgivens, scribu. fixes #18948.

File:
1 edited

Legend:

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

    r19712 r20287  
    267267    // FINALLY, delete user
    268268    if ( !is_multisite() ) {
    269         $wpdb->query( $wpdb->prepare("DELETE FROM $wpdb->usermeta WHERE user_id = %d", $id) );
    270         $wpdb->query( $wpdb->prepare("DELETE FROM $wpdb->users WHERE ID = %d", $id) );
     269        $wpdb->delete( $wpdb->usermeta, array( 'user_id' => $id ) );
     270        $wpdb->delete( $wpdb->users, array( 'ID' => $id ) );
    271271    } else {
    272272        $level_key = $wpdb->get_blog_prefix() . 'capabilities'; // wpmu site admins don't have user_levels
    273         $wpdb->query("DELETE FROM $wpdb->usermeta WHERE user_id = $id AND meta_key = '{$level_key}'");
     273        $wpdb->delete( $wpdb->usermeta, array( 'user_id' => $id , 'meta_key' => $level_key ) );
    274274    }
    275275
Note: See TracChangeset for help on using the changeset viewer.