Make WordPress Core


Ignore:
Timestamp:
05/24/2004 08:22:18 AM (21 years ago)
Author:
saxmatt
Message:

Giant commit, sorry mailing list people. Move all table names to new $wpdb versions. Works but the whole app needs thorough testing now.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-admin/users.php

    r1303 r1355  
    5656
    5757    /* checking the login isn't already used by another user */
    58     $loginthere = $wpdb->get_var("SELECT user_login FROM $tableusers WHERE user_login = '$user_login'");
     58    $loginthere = $wpdb->get_var("SELECT user_login FROM $wpdb->users WHERE user_login = '$user_login'");
    5959    if ($loginthere) {
    6060        die (__('<strong>ERROR</strong>: This login is already registered, please choose another one.'));
     
    7979    $new_users_can_blog = get_settings('new_users_can_blog');
    8080
    81     $result = $wpdb->query("INSERT INTO $tableusers
     81    $result = $wpdb->query("INSERT INTO $wpdb->users
    8282        (user_login, user_pass, user_nickname, user_email, user_ip, user_domain, user_browser, dateYMDhour, user_level, user_idmode, user_firstname, user_lastname, user_nicename)
    8383    VALUES
     
    123123    if ('up' == $prom) {
    124124        $new_level = $usertopromote_level + 1;
    125         $sql="UPDATE $tableusers SET user_level=$new_level WHERE ID = $id AND $new_level < $user_level";
     125        $sql="UPDATE $wpdb->users SET user_level=$new_level WHERE ID = $id AND $new_level < $user_level";
    126126    } elseif ('down' == $prom) {
    127127        $new_level = $usertopromote_level - 1;
    128         $sql="UPDATE $tableusers SET user_level=$new_level WHERE ID = $id AND $new_level < $user_level";
     128        $sql="UPDATE $wpdb->users SET user_level=$new_level WHERE ID = $id AND $new_level < $user_level";
    129129    }
    130130    $result = $wpdb->query($sql);
     
    153153        die(__('Can&#8217;t delete a user whose level is higher than yours.'));
    154154
    155     $post_ids = $wpdb->get_col("SELECT ID FROM $tableposts WHERE post_author = $id");
     155    $post_ids = $wpdb->get_col("SELECT ID FROM $wpdb->posts WHERE post_author = $id");
    156156    if ($post_ids) {
    157157        $post_ids = implode(',', $post_ids);
    158158       
    159159        // Delete comments, *backs
    160         $wpdb->query("DELETE FROM $tablecomments WHERE comment_post_ID IN ($post_ids)");
     160        $wpdb->query("DELETE FROM $wpdb->comments WHERE comment_post_ID IN ($post_ids)");
    161161        // Clean cats
    162         $wpdb->query("DELETE FROM $tablepost2cat WHERE post_id IN ($post_ids)");
     162        $wpdb->query("DELETE FROM $wpdb->post2cat WHERE post_id IN ($post_ids)");
    163163        // Clean post_meta
    164         $wpdb->query("DELETE FROM $tablepostmeta WHERE post_id IN ($post_ids)");
     164        $wpdb->query("DELETE FROM $wpdb->postmeta WHERE post_id IN ($post_ids)");
    165165        // Clean links
    166         $wpdb->query("DELETE FROM $tablelinks WHERE link_owner = $id");
     166        $wpdb->query("DELETE FROM $wpdb->links WHERE link_owner = $id");
    167167        // Delete posts
    168         $wpdb->query("DELETE FROM $tableposts WHERE post_author = $id");
     168        $wpdb->query("DELETE FROM $wpdb->posts WHERE post_author = $id");
    169169    }
    170170
    171171    // FINALLY, delete user
    172     $wpdb->query("DELETE FROM $tableusers WHERE ID = $id");
     172    $wpdb->query("DELETE FROM $wpdb->users WHERE ID = $id");
    173173    header('Location: users.php?deleted=true');
    174174
     
    196196    </tr>
    197197    <?php
    198     $users = $wpdb->get_results("SELECT ID FROM $tableusers WHERE user_level > 0 ORDER BY ID");
     198    $users = $wpdb->get_results("SELECT ID FROM $wpdb->users WHERE user_level > 0 ORDER BY ID");
    199199    $style = '';
    200200    foreach ($users as $user) {
     
    209209        $short_url =  substr($short_url, 0, 32).'...';
    210210        $style = ('class="alternate"' == $style) ? '' : 'class="alternate"';
    211         $numposts = $wpdb->get_var("SELECT COUNT(*) FROM $tableposts WHERE post_author = $user->ID and post_status = 'publish'");
     211        $numposts = $wpdb->get_var("SELECT COUNT(*) FROM $wpdb->posts WHERE post_author = $user->ID and post_status = 'publish'");
    212212        if (0 < $numposts) $numposts = "<a href='edit.php?author=$user_data->ID' title='" . __('View posts') . "'>$numposts</a>";
    213213        echo "
     
    234234
    235235<?php
    236     $users = $wpdb->get_results("SELECT * FROM $tableusers WHERE user_level = 0 ORDER BY ID");
     236    $users = $wpdb->get_results("SELECT * FROM $wpdb->users WHERE user_level = 0 ORDER BY ID");
    237237    if ($users) {
    238238?>
Note: See TracChangeset for help on using the changeset viewer.