Make WordPress Core

Changeset 43370


Ignore:
Timestamp:
06/18/2018 03:01:27 PM (6 years ago)
Author:
azaozz
Message:

Privacy: do not show the comment cookies opt-in checkbox (on the front-end comments form) when comment cookies are disabled.

Props felipeelia, johnbillion.
Fixes #44342.

File:
1 edited

Legend:

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

    r43304 r43370  
    22632263    $html_req = ( $req ? " required='required'" : '' );
    22642264    $html5    = 'html5' === $args['format'];
    2265     $consent  = empty( $commenter['comment_author_email'] ) ? '' : ' checked="checked"';
    22662265    $fields   = array(
    22672266        'author'  => '<p class="comment-form-author">' . '<label for="author">' . __( 'Name' ) . ( $req ? ' <span class="required">*</span>' : '' ) . '</label> ' .
     
    22712270        'url'     => '<p class="comment-form-url"><label for="url">' . __( 'Website' ) . '</label> ' .
    22722271                     '<input id="url" name="url" ' . ( $html5 ? 'type="url"' : 'type="text"' ) . ' value="' . esc_attr( $commenter['comment_author_url'] ) . '" size="30" maxlength="200" /></p>',
    2273         'cookies' => '<p class="comment-form-cookies-consent"><input id="wp-comment-cookies-consent" name="wp-comment-cookies-consent" type="checkbox" value="yes"' . $consent . ' />' .
    2274                      '<label for="wp-comment-cookies-consent">' . __( 'Save my name, email, and website in this browser for the next time I comment.' ) . '</label></p>',
    22752272    );
     2273
     2274    if ( has_action( 'set_comment_cookies', 'wp_set_comment_cookies' ) ) {
     2275        $consent           = empty( $commenter['comment_author_email'] ) ? '' : ' checked="checked"';
     2276        $fields['cookies'] = '<p class="comment-form-cookies-consent"><input id="wp-comment-cookies-consent" name="wp-comment-cookies-consent" type="checkbox" value="yes"' . $consent . ' />' .
     2277                             '<label for="wp-comment-cookies-consent">' . __( 'Save my name, email, and website in this browser for the next time I comment.' ) . '</label></p>';
     2278    }
    22762279
    22772280    $required_text = sprintf( ' ' . __( 'Required fields are marked %s' ), '<span class="required">*</span>' );
Note: See TracChangeset for help on using the changeset viewer.