Make WordPress Core


Ignore:
Timestamp:
03/09/2018 03:56:25 PM (7 years ago)
Author:
azaozz
Message:

Respect the commenter decision when they have checked the checkbox to consent to cookies, and keep it checked when they reload the page or post another comment.

See #43436.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/comment-template.php

    r42772 r42815  
    22612261    $html_req = ( $req ? " required='required'" : '' );
    22622262    $html5    = 'html5' === $args['format'];
     2263    $consent  = empty( $commenter['comment_author_email'] ) ? '' : ' checked="checked"';
    22632264    $fields   = array(
    22642265        'author'  => '<p class="comment-form-author">' . '<label for="author">' . __( 'Name' ) . ( $req ? ' <span class="required">*</span>' : '' ) . '</label> ' .
     
    22692270                     '<input id="url" name="url" ' . ( $html5 ? 'type="url"' : 'type="text"' ) . ' value="' . esc_attr( $commenter['comment_author_url'] ) . '" size="30" maxlength="200" /></p>',
    22702271        'cookies' => '<p class="comment-form-cookies-consent"><label for="wp-comment-cookies-consent">' .
    2271                      '<input id="wp-comment-cookies-consent" name="wp-comment-cookies-consent" type="checkbox" value="yes" />' .
     2272                     '<input id="wp-comment-cookies-consent" name="wp-comment-cookies-consent" type="checkbox" value="yes"' . $consent . ' />' .
    22722273                     __( 'Save my name, email, and site URL in my browser for next time I post a comment.' ) . '</label></p>',
    22732274    );
Note: See TracChangeset for help on using the changeset viewer.