Changeset 2976
- Timestamp:
- 10/29/2005 11:23:17 PM (19 years ago)
- Location:
- trunk/wp-includes
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-includes/functions.php
r2968 r2976 1276 1276 // Get the categories for all the posts 1277 1277 for ($i = 0; $i < count($posts); $i++) { 1278 $post_id_ list[] = $posts[$i]->ID;1278 $post_id_array[] = $posts[$i]->ID; 1279 1279 $post_cache[$posts[$i]->ID] = &$posts[$i]; 1280 1280 } 1281 1281 1282 $post_id_list = implode(',', $post_id_ list);1282 $post_id_list = implode(',', $post_id_array); 1283 1283 1284 1284 update_post_category_cache($post_id_list); 1285 1285 1286 1286 // Do the same for comment numbers 1287 $comment_counts = $wpdb->get_results("SELECT ID, COUNT( comment_ID ) AS ccount1288 FROM $wpdb-> posts1289 LEFT JOIN $wpdb->comments ON ( comment_post_ID = ID AND comment_approved = '1')1290 WHERE ID IN ($post_id_list)1291 GROUP BY ID");1287 $comment_counts = $wpdb->get_results("SELECT comment_post_ID, COUNT( comment_ID ) AS ccount 1288 FROM $wpdb->comments 1289 WHERE comment_post_ID IN ($post_id_list) 1290 AND comment_approved = '1' 1291 GROUP BY comment_post_ID"); 1292 1292 1293 1293 if ( $comment_counts ) { 1294 foreach ($comment_counts as $comment_count) 1295 $comment_count_cache["$comment_count->ID"] = $comment_count->ccount; 1294 foreach ($comment_counts as $comment_count) { 1295 $comment_count_cache["$comment_count->comment_post_ID"] = $comment_count->ccount; 1296 $got_count[] = $comment_count->comment_post_ID; 1297 } 1298 foreach ( $post_id_array as $id ) 1299 if ( !in_array( $id, $got_count ) ) 1300 $comment_count_cache["$id"] = 0; 1296 1301 } 1297 1302 -
trunk/wp-includes/pluggable-functions.php
r2872 r2976 93 93 global $cache_userdata, $wpdb; 94 94 $user_login = sanitize_user( $user_login ); 95 95 96 if ( empty( $user_login ) ) 96 97 return false; 98 97 99 if ( isset( $cache_userdata[$user_login] ) ) 98 100 return $cache_userdata[$user_login]; 99 100 $user_id = $wpdb->get_var("SELECT ID FROM $wpdb->users WHERE user_login = '$user_login'"); 101 102 return get_userdata( $user_id ); 101 102 if ( !$user = $wpdb->get_row("SELECT * FROM $wpdb->users WHERE user_login = '$user_login'") ) 103 return $cache_userdata[$user_login] = false; 104 105 $metavalues = $wpdb->get_results("SELECT meta_key, meta_value FROM $wpdb->usermeta WHERE user_id = '$user->ID'"); 106 107 foreach ( $metavalues as $meta ) { 108 @ $value = unserialize($meta->meta_value); 109 if ($value === FALSE) 110 $value = $meta->meta_value; 111 $user->{$meta->meta_key} = $value; 112 113 // We need to set user_level from meta, not row 114 if ( $wpdb->prefix . 'user_level' == $meta->meta_key ) 115 $user->user_level = $meta->meta_value; 116 } 117 118 $cache_userdata[$user->ID] = $user; 119 $cache_userdata[$cache_userdata[$user->ID]->user_login] =& $cache_userdata[$user->ID]; 120 121 return $cache_userdata[$user->ID]; 122 103 123 } 104 124 endif; -
trunk/wp-includes/template-functions-category.php
r2975 r2976 25 25 26 26 if ( empty($catlink) ) { 27 $file = get_settings('home') . '/' . get_settings('blogfilename');27 $file = get_settings('home') . '/'; 28 28 $catlink = $file . '?cat=' . $category_id; 29 29 } else {
Note: See TracChangeset
for help on using the changeset viewer.