Make WordPress Core


Ignore:
Timestamp:
05/02/2018 10:10:30 PM (7 years ago)
Author:
SergeyBiryukov
Message:

Add a checkbox to the comment form so logged out users can opt-out of commenter cookies.

Props lakenh, xkon, birgire, azaozz, johnbillion.
Merges [42772] and [43042] to the 4.9 branch.
See #43436.

Location:
branches/4.9
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/4.9

  • branches/4.9/src/wp-comments-post.php

    r38432 r43127  
    3434
    3535$user = wp_get_current_user();
     36$cookies_consent = ( isset( $_POST['wp-comment-cookies-consent'] ) );
    3637
    3738/**
     
    3940 *
    4041 * @since 3.4.0
     42 * @since 4.9.6 The `$cookies_consent` parameter was added.
    4143 *
    42  * @param WP_Comment $comment Comment object.
    43  * @param WP_User    $user    User object. The user may not exist.
     44 * @param WP_Comment $comment         Comment object.
     45 * @param WP_User    $user            Comment author's user object. The user may not exist.
     46 * @param boolean    $cookies_consent Comment author's consent to store cookies.
    4447 */
    45 do_action( 'set_comment_cookies', $comment, $user );
     48do_action( 'set_comment_cookies', $comment, $user, $cookies_consent );
    4649
    4750$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.