mirror of
https://github.com/gosticks/wordpress-develop.git
synced 2026-08-11 12:20:22 +00:00
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:
@@ -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 {
|
||||
|
||||
Reference in New Issue
Block a user