Changeset 50375 for trunk/src/wp-comments-post.php
- Timestamp:
- 02/17/2021 01:06:43 PM (5 years ago)
- File:
-
- 1 edited
-
trunk/src/wp-comments-post.php (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-comments-post.php
r50109 r50375 23 23 nocache_headers(); 24 24 25 if ( isset( $_POST['wp-comment-approved-notification-optin'], $_POST['comment_ID'], $_POST['moderation-hash'] ) ) { 26 $comment = get_comment( $_POST['comment_ID'] ); 27 28 if ( $comment && hash_equals( $_POST['moderation-hash'], wp_hash( $comment->comment_date_gmt ) ) ) { 29 update_comment_meta( $comment->comment_ID, '_wp_comment_author_notification_optin', true ); 30 } else { 25 $comment = wp_handle_comment_submission( wp_unslash( $_POST ) ); 26 if ( is_wp_error( $comment ) ) { 27 $data = (int) $comment->get_error_data(); 28 if ( ! empty( $data ) ) { 31 29 wp_die( 32 '<p>' . __( 'Invalid comment ID.') . '</p>',33 __( 'Comment Notification Opt-in Failure' ),30 '<p>' . $comment->get_error_message() . '</p>', 31 __( 'Comment Submission Failure' ), 34 32 array( 35 'response' => 404,33 'response' => $data, 36 34 'back_link' => true, 37 35 ) 38 36 ); 37 } else { 38 exit; 39 39 } 40 } else { 41 $comment = wp_handle_comment_submission( wp_unslash( $_POST ) ); 42 if ( is_wp_error( $comment ) ) { 43 $data = (int) $comment->get_error_data(); 44 if ( ! empty( $data ) ) { 45 wp_die( 46 '<p>' . $comment->get_error_message() . '</p>', 47 __( 'Comment Submission Failure' ), 48 array( 49 'response' => $data, 50 'back_link' => true, 51 ) 52 ); 53 } else { 54 exit; 55 } 56 } 40 } 57 41 58 $user = wp_get_current_user();59 $cookies_consent = ( isset( $_POST['wp-comment-cookies-consent'] ) );42 $user = wp_get_current_user(); 43 $cookies_consent = ( isset( $_POST['wp-comment-cookies-consent'] ) ); 60 44 61 /** 62 * Perform other actions when comment cookies are set. 63 * 64 * @since 3.4.0 65 * @since 4.9.6 The `$cookies_consent` parameter was added. 66 * 67 * @param WP_Comment $comment Comment object. 68 * @param WP_User $user Comment author's user object. The user may not exist. 69 * @param bool $cookies_consent Comment author's consent to store cookies. 70 */ 71 do_action( 'set_comment_cookies', $comment, $user, $cookies_consent ); 72 } 45 /** 46 * Perform other actions when comment cookies are set. 47 * 48 * @since 3.4.0 49 * @since 4.9.6 The `$cookies_consent` parameter was added. 50 * 51 * @param WP_Comment $comment Comment object. 52 * @param WP_User $user Comment author's user object. The user may not exist. 53 * @param bool $cookies_consent Comment author's consent to store cookies. 54 */ 55 do_action( 'set_comment_cookies', $comment, $user, $cookies_consent ); 73 56 74 57 $location = empty( $_POST['redirect_to'] ) ? get_comment_link( $comment ) : $_POST['redirect_to'] . '#comment-' . $comment->comment_ID;
Note: See TracChangeset
for help on using the changeset viewer.