Cache user lookups made by nicename. Add get_user_by(). fixes #4170

git-svn-id: https://develop.svn.wordpress.org/trunk@10992 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Ryan Boren
2009-04-17 21:25:11 +00:00
parent 4fbd3a712a
commit fcb4384381
4 changed files with 51 additions and 38 deletions
+3
View File
@@ -2004,6 +2004,9 @@ class WP_Query {
}
$q['author_name'] = sanitize_title($q['author_name']);
$q['author'] = $wpdb->get_var("SELECT ID FROM $wpdb->users WHERE user_nicename='".$q['author_name']."'");
$q['author'] = get_user_by('slug', $q['author_name']);
if ( $q['author'] )
$q['author'] = $q['author']->ID;
$whichauthor .= " AND ($wpdb->posts.post_author = ".absint($q['author']).')';
}