Move most instances of new WP_User to get_userdata(). see #21120.

git-svn-id: https://develop.svn.wordpress.org/trunk@21413 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Andrew Nacin
2012-08-03 01:06:05 +00:00
parent 28562bc58a
commit a5c7405975
16 changed files with 56 additions and 59 deletions
+3 -4
View File
@@ -650,13 +650,12 @@ function wp_allow_comment($commentdata) {
do_action( 'check_comment_flood', $comment_author_IP, $comment_author_email, $comment_date_gmt );
if ( isset($user_id) && $user_id) {
$userdata = get_userdata($user_id);
$user = new WP_User($user_id);
if ( ! empty( $user_id ) ) {
$user = get_userdata( $user_id );
$post_author = $wpdb->get_var($wpdb->prepare("SELECT post_author FROM $wpdb->posts WHERE ID = %d LIMIT 1", $comment_post_ID));
}
if ( isset($userdata) && ( $user_id == $post_author || $user->has_cap('moderate_comments') ) ) {
if ( $user && ( $user_id == $post_author || $user->has_cap('moderate_comments') ) ) {
// The author and the admins get respect.
$approved = 1;
} else {