Make WordPress Core

Changeset 43128


Ignore:
Timestamp:
05/02/2018 10:12:28 PM (6 years ago)
Author:
SergeyBiryukov
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.

Props azaozz.
Merges [42815] 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-includes/comment-template.php

    r43127 r43128  
    21952195    $html_req = ( $req ? " required='required'" : '' );
    21962196    $html5    = 'html5' === $args['format'];
     2197    $consent  = empty( $commenter['comment_author_email'] ) ? '' : ' checked="checked"';
    21972198    $fields   =  array(
    21982199        'author'  => '<p class="comment-form-author">' . '<label for="author">' . __( 'Name' ) . ( $req ? ' <span class="required">*</span>' : '' ) . '</label> ' .
     
    22032204                     '<input id="url" name="url" ' . ( $html5 ? 'type="url"' : 'type="text"' ) . ' value="' . esc_attr( $commenter['comment_author_url'] ) . '" size="30" maxlength="200" /></p>',
    22042205        'cookies' => '<p class="comment-form-cookies-consent"><label for="wp-comment-cookies-consent">' .
    2205                      '<input id="wp-comment-cookies-consent" name="wp-comment-cookies-consent" type="checkbox" value="yes" />' .
     2206                     '<input id="wp-comment-cookies-consent" name="wp-comment-cookies-consent" type="checkbox" value="yes"' . $consent . ' />' .
    22062207                     __( 'Save my name, email, and site URL in my browser for next time I post a comment.' ) . '</label></p>',
    22072208    );
Note: See TracChangeset for help on using the changeset viewer.