Make WordPress Core


Ignore:
Timestamp:
03/04/2018 04:40:43 PM (7 years ago)
Author:
azaozz
Message:

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

Props lakenh, xkon, birgire, azaozz.
See #43436.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-comments-post.php

    r42343 r42772  
    3939
    4040$user = wp_get_current_user();
     41$cookies_consent = ( isset( $_POST['wp-comment-cookies-consent'] ) );
    4142
    4243/**
     
    4546 * @since 3.4.0
    4647 *
    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 boolean    $cookies_consent Whether the user has opted-in commenter cookies.
    4951 */
    50 do_action( 'set_comment_cookies', $comment, $user );
     52do_action( 'set_comment_cookies', $comment, $user, $cookies_consent );
    5153
    5254$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.