diff --git a/wp-comments-post.php b/wp-comments-post.php
index 39bc5a8..46e7b3b 100644
a
|
b
|
if ( is_wp_error( $comment ) ) { |
38 | 38 | } |
39 | 39 | |
40 | 40 | $user = wp_get_current_user(); |
| 41 | $cookie_consent = ( isset( $_POST['cookies'] ) ) ? true : false; |
41 | 42 | |
42 | 43 | /** |
43 | 44 | * Perform other actions when comment cookies are set. |
44 | 45 | * |
45 | 46 | * @since 3.4.0 |
46 | 47 | * |
47 | | * @param WP_Comment $comment Comment object. |
48 | | * @param WP_User $user User object. The user may not exist. |
| 48 | * @param WP_Comment $comment Comment object. |
| 49 | * @param WP_User $user User object. The user may not exist. |
| 50 | * @param string $cookie_consent The 'cookies' parmater sent via $_POST. |
49 | 51 | */ |
50 | | do_action( 'set_comment_cookies', $comment, $user ); |
| 52 | do_action( 'set_comment_cookies', $comment, $user, $cookie_consent ); |
51 | 53 | |
52 | 54 | $location = empty( $_POST['redirect_to'] ) ? get_comment_link( $comment ) : $_POST['redirect_to'] . '#comment-' . $comment->comment_ID; |
53 | 55 | |
diff --git a/wp-includes/comment-template.php b/wp-includes/comment-template.php
index 5795362..7666164 100644
a
|
b
|
function comment_form( $args = array(), $post_id = null ) { |
2267 | 2267 | '<input id="email" name="email" ' . ( $html5 ? 'type="email"' : 'type="text"' ) . ' value="' . esc_attr( $commenter['comment_author_email'] ) . '" size="30" maxlength="100" aria-describedby="email-notes"' . $html_req . ' /></p>', |
2268 | 2268 | 'url' => '<p class="comment-form-url"><label for="url">' . __( 'Website' ) . '</label> ' . |
2269 | 2269 | '<input id="url" name="url" ' . ( $html5 ? 'type="url"' : 'type="text"' ) . ' value="' . esc_attr( $commenter['comment_author_url'] ) . '" size="30" maxlength="200" /></p>', |
| 2270 | 'cookies' => '<p class="comment-form-cookies"><input id="cookies" name="cookies" type="checkbox" checked="checked" />' . |
| 2271 | '<label for="cookies">' . __('Save my name, email, and site URL in my browser for next time I post a comment.') . '</label></p>', |
2270 | 2272 | ); |
2271 | 2273 | |
2272 | 2274 | $required_text = sprintf( ' ' . __( 'Required fields are marked %s' ), '<span class="required">*</span>' ); |
diff --git a/wp-includes/comment.php b/wp-includes/comment.php
index 0d35f09..a709496 100644
a
|
b
|
function wp_queue_comments_for_comment_meta_lazyload( $comments ) { |
542 | 542 | * |
543 | 543 | * @param WP_Comment $comment Comment object. |
544 | 544 | * @param object $user Comment author's object. |
| 545 | * @param boolean $cookie_consent Comment author's permission to store cookies. |
545 | 546 | * |
546 | 547 | * @since 3.4.0 |
547 | 548 | */ |
548 | | function wp_set_comment_cookies( $comment, $user ) { |
549 | | if ( $user->exists() ) { |
| 549 | function wp_set_comment_cookies( $comment, $user, $cookie_consent ) { |
| 550 | // If the user already exists, or the user opted out of cookies, don't set cookies. |
| 551 | if ( $user->exists() || ( false == $cookie_consent ) ) { |
550 | 552 | return; |
551 | 553 | } |
552 | 554 | |
diff --git a/wp-includes/default-filters.php b/wp-includes/default-filters.php
index 6b60625..090adfe 100644
a
|
b
|
add_action( 'do_feed_rss2', 'do_feed_rss2', 10, 1 ); |
327 | 327 | add_action( 'do_feed_atom', 'do_feed_atom', 10, 1 ); |
328 | 328 | add_action( 'do_pings', 'do_all_pings', 10, 1 ); |
329 | 329 | add_action( 'do_robots', 'do_robots' ); |
330 | | add_action( 'set_comment_cookies', 'wp_set_comment_cookies', 10, 2 ); |
| 330 | add_action( 'set_comment_cookies', 'wp_set_comment_cookies', 10, 3 ); |
331 | 331 | add_action( 'sanitize_comment_cookies', 'sanitize_comment_cookies' ); |
332 | 332 | add_action( 'admin_print_scripts', 'print_emoji_detection_script' ); |
333 | 333 | add_action( 'admin_print_scripts', 'print_head_scripts', 20 ); |