Make WordPress Core


Ignore:
Timestamp:
06/23/2020 01:51:03 PM (5 years ago)
Author:
SergeyBiryukov
Message:

Comments: Remove wp_get_include_unapproved_comments_argument() for now.

The function seems too specific and low-level for an abstraction, is only used in two places, and does not provide a significant benefit in terms of reducing code duplication.

Follow-up to [48133].

See #8973.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/comment-template.php

    r48133 r48140  
    13311331 *
    13321332 * @since 1.5.0
    1333  * @since 5.5.0 Removed the need to use the $user_ID global.
    13341333 *
    13351334 * @global WP_Query   $wp_query         WordPress Query object.
     
    13971396    }
    13981397
    1399     $include_unapproved = wp_get_include_unapproved_comments_argument();
    1400     if ( $include_unapproved ) {
    1401         $comment_args['include_unapproved'] = $include_unapproved;
     1398    if ( is_user_logged_in() ) {
     1399        $comment_args['include_unapproved'] = array( get_current_user_id() );
     1400    } else {
     1401        $unapproved_email = wp_get_unapproved_comment_author_email();
     1402
     1403        if ( $unapproved_email ) {
     1404            $comment_args['include_unapproved'] = array( $unapproved_email );
     1405        }
    14021406    }
    14031407
     
    20982102
    20992103                if ( is_user_logged_in() ) {
    2100                     $comment_args['include_unapproved'] = get_current_user_id();
     2104                    $comment_args['include_unapproved'] = array( get_current_user_id() );
    21012105                } else {
    21022106                    $unapproved_email = wp_get_unapproved_comment_author_email();
Note: See TracChangeset for help on using the changeset viewer.