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. Built from https://develop.svn.wordpress.org/trunk@53747 git-svn-id: http://core.svn.wordpress.org/trunk@53306 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
49dd15fb6b
commit
ee4f7d7415
|
@ -1297,12 +1297,10 @@ function wp_ajax_replyto_comment( $action ) {
|
|||
$user = wp_get_current_user();
|
||||
|
||||
if ( $user->exists() ) {
|
||||
$user_id = $user->ID;
|
||||
$comment_author = wp_slash( $user->display_name );
|
||||
$comment_author_email = wp_slash( $user->user_email );
|
||||
$comment_author_url = wp_slash( $user->user_url );
|
||||
$comment_content = trim( $_POST['content'] );
|
||||
$comment_type = isset( $_POST['comment_type'] ) ? trim( $_POST['comment_type'] ) : 'comment';
|
||||
$user_id = $user->ID;
|
||||
|
||||
if ( current_user_can( 'unfiltered_html' ) ) {
|
||||
if ( ! isset( $_POST['_wp_unfiltered_html_comment'] ) ) {
|
||||
|
@ -1320,10 +1318,14 @@ function wp_ajax_replyto_comment( $action ) {
|
|||
wp_die( __( 'Sorry, you must be logged in to reply to a comment.' ) );
|
||||
}
|
||||
|
||||
$comment_content = trim( $_POST['content'] );
|
||||
|
||||
if ( '' === $comment_content ) {
|
||||
wp_die( __( 'Please type your comment text.' ) );
|
||||
}
|
||||
|
||||
$comment_type = isset( $_POST['comment_type'] ) ? trim( $_POST['comment_type'] ) : 'comment';
|
||||
|
||||
$comment_parent = 0;
|
||||
|
||||
if ( isset( $_POST['comment_ID'] ) ) {
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
*
|
||||
* @global string $wp_version
|
||||
*/
|
||||
$wp_version = '6.1-alpha-53746';
|
||||
$wp_version = '6.1-alpha-53747';
|
||||
|
||||
/**
|
||||
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.
|
||||
|
|
Loading…
Reference in New Issue