Make WordPress Core

Changeset 53747


Ignore:
Timestamp:
07/21/2022 10:57:03 AM (2 years ago)
Author:
SergeyBiryukov
Message:

Coding Standards: Adjust the logic slightly in wp_ajax_replyto_comment().

This aims to bring more consistency to the function logic by separating the comment content and type checks from the user existence check.

Follow-up to [8720], [9098], [29758].

See #55647.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-admin/includes/ajax-actions.php

    r53729 r53747  
    12981298
    12991299    if ( $user->exists() ) {
    1300         $user_id              = $user->ID;
    13011300        $comment_author       = wp_slash( $user->display_name );
    13021301        $comment_author_email = wp_slash( $user->user_email );
    13031302        $comment_author_url   = wp_slash( $user->user_url );
    1304         $comment_content      = trim( $_POST['content'] );
    1305         $comment_type         = isset( $_POST['comment_type'] ) ? trim( $_POST['comment_type'] ) : 'comment';
     1303        $user_id              = $user->ID;
    13061304
    13071305        if ( current_user_can( 'unfiltered_html' ) ) {
     
    13211319    }
    13221320
     1321    $comment_content = trim( $_POST['content'] );
     1322
    13231323    if ( '' === $comment_content ) {
    13241324        wp_die( __( 'Please type your comment text.' ) );
    13251325    }
     1326
     1327    $comment_type = isset( $_POST['comment_type'] ) ? trim( $_POST['comment_type'] ) : 'comment';
    13261328
    13271329    $comment_parent = 0;
Note: See TracChangeset for help on using the changeset viewer.