Make WordPress Core

Ticket #55218: ticket55218.patch

File ticket55218.patch, 1.4 KB (added by genosseeinhorn, 3 years ago)
  • src/wp-includes/class-wp-comment-query.php

    From 0d9e0922189a724bddad40351f71820684b754ad Mon Sep 17 00:00:00 2001
    From: =?UTF-8?q?Jonas=20K=C3=BCmmerlin?= <jonas@kuemmerlin.eu>
    Date: Mon, 21 Feb 2022 18:50:49 +0100
    Subject: [PATCH] WP_Comment_Query: fix ambiguous colum 'comment_ID'
    
    when mixing 'include_unapproved' with 'meta_query'.
    
    Ticket #55218
    ---
     src/wp-includes/class-wp-comment-query.php | 2 +-
     1 file changed, 1 insertion(+), 1 deletion(-)
    
    diff --git a/src/wp-includes/class-wp-comment-query.php b/src/wp-includes/class-wp-comment-query.php
    index ad5fb01..6a83e3a 100644
    a b class WP_Comment_Query { 
    595595                                        // Otherwise we match against email addresses.
    596596                                        if ( ! empty( $_GET['unapproved'] ) && ! empty( $_GET['moderation-hash'] ) ) {
    597597                                                // Only include requested comment.
    598                                                 $approved_clauses[] = $wpdb->prepare( "( comment_author_email = %s AND comment_approved = '0' AND comment_ID = %d )", $unapproved_identifier, (int) $_GET['unapproved'] );
     598                                                $approved_clauses[] = $wpdb->prepare( "( comment_author_email = %s AND comment_approved = '0' AND $wpdb->comments.comment_ID = %d )", $unapproved_identifier, (int) $_GET['unapproved'] );
    599599                                        } else {
    600600                                                // Include all of the author's unapproved comments.
    601601                                                $approved_clauses[] = $wpdb->prepare( "( comment_author_email = %s AND comment_approved = '0' )", $unapproved_identifier );