Make WordPress Core

Changeset 1186


Ignore:
Timestamp:
04/27/2004 03:59:13 AM (20 years ago)
Author:
rboren
Message:

Unify user and author queries on cache_userdata

Location:
trunk
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-blog-header.php

    r1184 r1186  
    271271}
    272272
    273 // author stuff
    274 foreach ($users as $auteur) {
    275     $cache_authors[$auteur->ID] = $auteur;
     273// Author/user stuff
     274$users = $wpdb->get_results("SELECT * FROM $tableusers WHERE 1=1");
     275foreach ($users as $user) {
     276    $cache_userdata[$user->ID] = $user;
    276277}
    277278
  • trunk/wp-includes/functions.php

    r1184 r1186  
    176176
    177177function get_userdata($userid) {
    178     global $wpdb, $cache_authors, $tableusers;
    179     if ( empty($cache_authors[$userid]) ) {
     178    global $wpdb, $cache_userdata, $tableusers;
     179    if ( empty($cache_userdata[$userid]) ) {
    180180        $user = $wpdb->get_row("SELECT * FROM $tableusers WHERE ID = '$userid'");
    181181        $user->user_nickname = stripslashes($user->user_nickname);
     
    10961096    }
    10971097    $authordata = get_userdata($post->post_author);
     1098
    10981099    $day = mysql2date('d.m.y', $post->post_date);
    10991100    $currentmonth = mysql2date('m', $post->post_date);
  • trunk/wp-includes/template-functions-author.php

    r1095 r1186  
    66        $idmode = $authordata->user_idmode;
    77    }
     8
    89    if ($idmode == 'nickname')    $id = $authordata->user_nickname;
    910    if ($idmode == 'login')    $id = $authordata->user_login;
     
    7778
    7879function get_author_link($echo = false, $author_id, $author_nicename) {
    79     global $wpdb, $tableusers, $post, $querystring_start, $querystring_equal, $cache_authors;
     80    global $wpdb, $tableusers, $post, $querystring_start, $querystring_equal, $cache_userdata;
    8081    $auth_ID = $author_id;
    8182    $permalink_structure = get_settings('permalink_structure');
     
    8586        $link = $file.$querystring_start.'author'.$querystring_equal.$auth_ID;
    8687    } else {
    87         if ('' == $author_nicename) $author_nicename = $cache_authors[$author_id]->author_nicename;
     88        if ('' == $author_nicename) $author_nicename = $cache_userdata[$author_id]->author_nicename;
    8889        // Get any static stuff from the front
    8990        $front = substr($permalink_structure, 0, strpos($permalink_structure, '%'));
Note: See TracChangeset for help on using the changeset viewer.