diff --git src/wp-admin/includes/ajax-actions.php src/wp-admin/includes/ajax-actions.php
index d1700d9fa0..be84ed707b 100644
|
|
|
function wp_ajax_replyto_comment( $action ) { |
| 1280 | 1280 | $comment_author_email = wp_slash( $user->user_email ); |
| 1281 | 1281 | $comment_author_url = wp_slash( $user->user_url ); |
| 1282 | 1282 | $comment_content = trim( $_POST['content'] ); |
| 1283 | | $comment_type = isset( $_POST['comment_type'] ) ? trim( $_POST['comment_type'] ) : ''; |
| | 1283 | $comment_type = isset( $_POST['comment_type'] ) ? trim( $_POST['comment_type'] ) : 'comment'; |
| 1284 | 1284 | |
| 1285 | 1285 | if ( current_user_can( 'unfiltered_html' ) ) { |
| 1286 | 1286 | if ( ! isset( $_POST['_wp_unfiltered_html_comment'] ) ) { |
diff --git src/wp-admin/includes/schema.php src/wp-admin/includes/schema.php
index a2e8216457..b6bea35526 100644
|
|
|
CREATE TABLE $wpdb->comments ( |
| 111 | 111 | comment_karma int(11) NOT NULL default '0', |
| 112 | 112 | comment_approved varchar(20) NOT NULL default '1', |
| 113 | 113 | comment_agent varchar(255) NOT NULL default '', |
| 114 | | comment_type varchar(20) NOT NULL default '', |
| | 114 | comment_type varchar(20) NOT NULL default 'comment', |
| 115 | 115 | comment_parent bigint(20) unsigned NOT NULL default '0', |
| 116 | 116 | user_id bigint(20) unsigned NOT NULL default '0', |
| 117 | 117 | PRIMARY KEY (comment_ID), |
diff --git src/wp-admin/includes/upgrade.php src/wp-admin/includes/upgrade.php
index 505b0aad17..672bf1928d 100644
|
|
|
Commenter avatars come from <a href="https://gravatar.com">Gravatar</a>.' |
| 283 | 283 | 'comment_date' => $now, |
| 284 | 284 | 'comment_date_gmt' => $now_gmt, |
| 285 | 285 | 'comment_content' => $first_comment, |
| | 286 | 'comment_type' => 'comment', |
| 286 | 287 | ) |
| 287 | 288 | ); |
| 288 | 289 | |
| … |
… |
function upgrade_all() { |
| 833 | 834 | upgrade_530(); |
| 834 | 835 | } |
| 835 | 836 | |
| | 837 | if ( $wp_current_db_version < 47086 ) { |
| | 838 | upgrade_540(); |
| | 839 | } |
| | 840 | |
| 836 | 841 | maybe_disable_link_manager(); |
| 837 | 842 | |
| 838 | 843 | maybe_disable_automattic_widgets(); |
| … |
… |
function upgrade_530() { |
| 2148 | 2153 | } |
| 2149 | 2154 | } |
| 2150 | 2155 | |
| | 2156 | /** |
| | 2157 | * Executes changes made in WordPress 5.4.0 |
| | 2158 | * |
| | 2159 | * @ignore |
| | 2160 | * @since 5.4.0 |
| | 2161 | */ |
| | 2162 | function upgrade_540() { |
| | 2163 | global $wpdb; |
| | 2164 | |
| | 2165 | // Update the `comment_type` field value to be `comment` for the rows about comments. |
| | 2166 | $wpdb->update( $wpdb->comments, array( 'comment_type' => 'comment' ), array( 'comment_type' => '' ) ); |
| | 2167 | } |
| | 2168 | |
| 2151 | 2169 | /** |
| 2152 | 2170 | * Executes network-level upgrade routines. |
| 2153 | 2171 | * |
diff --git src/wp-content/themes/twentyten/functions.php src/wp-content/themes/twentyten/functions.php
index 97f018d4ab..6ffbfc16bd 100644
|
|
|
if ( ! function_exists( 'twentyten_comment' ) ) : |
| 418 | 418 | $GLOBALS['comment'] = $comment; |
| 419 | 419 | switch ( $comment->comment_type ) : |
| 420 | 420 | case '': |
| | 421 | case 'comment': |
| 421 | 422 | ?> |
| 422 | 423 | <li <?php comment_class(); ?> id="li-comment-<?php comment_ID(); ?>"> |
| 423 | 424 | <div id="comment-<?php comment_ID(); ?>"> |
diff --git src/wp-includes/class-wp-comment-query.php src/wp-includes/class-wp-comment-query.php
index 9038b6194b..2cb8fc4044 100644
|
|
|
class WP_Comment_Query { |
| 741 | 741 | |
| 742 | 742 | case 'comment': |
| 743 | 743 | case 'comments': |
| 744 | | $comment_types[ $operator ][] = "''"; |
| | 744 | $comment_types[ $operator ][] = "'comment'"; |
| 745 | 745 | break; |
| 746 | 746 | |
| 747 | 747 | case 'pings': |
diff --git src/wp-includes/class-wp-comment.php src/wp-includes/class-wp-comment.php
index 70d7db2bd8..9b3b57e206 100644
|
|
|
final class WP_Comment { |
| 116 | 116 | * @since 4.4.0 |
| 117 | 117 | * @var string |
| 118 | 118 | */ |
| 119 | | public $comment_type = ''; |
| | 119 | public $comment_type = 'comment'; |
| 120 | 120 | |
| 121 | 121 | /** |
| 122 | 122 | * Parent comment ID. |
diff --git src/wp-includes/comment.php src/wp-includes/comment.php
index fca5ab9db4..53c7dcf483 100644
|
|
|
function wp_insert_comment( $commentdata ) { |
| 1901 | 1901 | $comment_karma = ! isset( $data['comment_karma'] ) ? 0 : $data['comment_karma']; |
| 1902 | 1902 | $comment_approved = ! isset( $data['comment_approved'] ) ? 1 : $data['comment_approved']; |
| 1903 | 1903 | $comment_agent = ! isset( $data['comment_agent'] ) ? '' : $data['comment_agent']; |
| 1904 | | $comment_type = ! isset( $data['comment_type'] ) ? '' : $data['comment_type']; |
| | 1904 | $comment_type = ! isset( $data['comment_type'] ) ? 'comment' : $data['comment_type']; |
| 1905 | 1905 | $comment_parent = ! isset( $data['comment_parent'] ) ? 0 : $data['comment_parent']; |
| 1906 | 1906 | |
| 1907 | 1907 | $user_id = ! isset( $data['user_id'] ) ? 0 : $data['user_id']; |
| … |
… |
function wp_throttle_comment_flood( $block, $time_lastcomment, $time_newcomment |
| 2057 | 2057 | * @type string $comment_author_email The comment author email address. |
| 2058 | 2058 | * @type string $comment_author_url The comment author URL. |
| 2059 | 2059 | * @type string $comment_content The content of the comment. |
| | 2060 | * @type string $comment_type The name of the comment type. |
| 2060 | 2061 | * @type string $comment_date The date the comment was submitted. Default is the current time. |
| 2061 | 2062 | * @type string $comment_date_gmt The date the comment was submitted in the GMT timezone. |
| 2062 | 2063 | * Default is `$comment_date` in the GMT timezone. |
| … |
… |
function wp_new_comment( $commentdata, $avoid_die = false ) { |
| 2122 | 2123 | $commentdata['comment_date_gmt'] = current_time( 'mysql', 1 ); |
| 2123 | 2124 | } |
| 2124 | 2125 | |
| | 2126 | if ( empty( $commentdata['comment_type'] ) ) { |
| | 2127 | $commentdata['comment_type'] = 'comment'; |
| | 2128 | } |
| | 2129 | |
| 2125 | 2130 | $commentdata = wp_filter_comment( $commentdata ); |
| 2126 | 2131 | |
| 2127 | 2132 | $commentdata['comment_approved'] = wp_allow_comment( $commentdata, $avoid_die ); |
| … |
… |
function wp_handle_comment_submission( $comment_data ) { |
| 3342 | 3347 | } |
| 3343 | 3348 | } |
| 3344 | 3349 | |
| 3345 | | $comment_type = ''; |
| | 3350 | $comment_type = 'comment'; |
| 3346 | 3351 | |
| 3347 | 3352 | if ( get_option( 'require_name_email' ) && ! $user->exists() ) { |
| 3348 | 3353 | if ( '' == $comment_author_email || '' == $comment_author ) { |
diff --git src/wp-includes/rest-api/endpoints/class-wp-rest-comments-controller.php src/wp-includes/rest-api/endpoints/class-wp-rest-comments-controller.php
index e05f9802ea..1533def2f2 100644
|
|
|
class WP_REST_Comments_Controller extends WP_REST_Controller { |
| 507 | 507 | return $prepared_comment; |
| 508 | 508 | } |
| 509 | 509 | |
| 510 | | $prepared_comment['comment_type'] = ''; |
| | 510 | $prepared_comment['comment_type'] = 'comment'; |
| 511 | 511 | |
| 512 | 512 | /* |
| 513 | 513 | * Do not allow a comment to be created with missing or empty |
diff --git src/wp-includes/version.php src/wp-includes/version.php
index b3deb5ad92..e1b1bb19a7 100644
|
|
|
$wp_version = '5.4-alpha-46582-src'; |
| 20 | 20 | * |
| 21 | 21 | * @global int $wp_db_version |
| 22 | 22 | */ |
| 23 | | $wp_db_version = 47018; |
| | 23 | $wp_db_version = 47086; |
| 24 | 24 | |
| 25 | 25 | /** |
| 26 | 26 | * Holds the TinyMCE version |
diff --git tests/phpunit/tests/comment-submission.php tests/phpunit/tests/comment-submission.php
index 2d288b3e85..377ad959a4 100644
|
|
|
class Tests_Comment_Submission extends WP_UnitTestCase { |
| 742 | 742 | 'comment_author_email' => $user->user_email, |
| 743 | 743 | 'comment_author_url' => $user->user_url, |
| 744 | 744 | 'comment_content' => $data['comment'], |
| 745 | | 'comment_type' => '', |
| | 745 | 'comment_type' => 'comment', |
| 746 | 746 | 'comment_parent' => '0', |
| 747 | 747 | 'user_ID' => $user->ID, |
| 748 | 748 | 'user_id' => $user->ID, |