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

Props felipeelia, johnbillion.
Merges [43370] to the 4.9 branch.
Fixes #44342.
Built from https://develop.svn.wordpress.org/branches/4.9@43449


git-svn-id: http://core.svn.wordpress.org/branches/4.9@43276 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Sergey Biryukov 2018-07-16 12:07:25 +00:00
parent b74a18dc8b
commit 9ad59101ab
2 changed files with 8 additions and 5 deletions

View File

@ -2196,7 +2196,6 @@ function comment_form( $args = array(), $post_id = null ) {
$req = get_option( 'require_name_email' );
$html_req = ( $req ? " required='required'" : '' );
$html5 = 'html5' === $args['format'];
$consent = empty( $commenter['comment_author_email'] ) ? '' : ' checked="checked"';
$fields = array(
'author' => '<p class="comment-form-author">' . '<label for="author">' . __( 'Name' ) . ( $req ? ' <span class="required">*</span>' : '' ) . '</label> ' .
'<input id="author" name="author" type="text" value="' . esc_attr( $commenter['comment_author'] ) . '" size="30" maxlength="245"' . $html_req . ' /></p>',
@ -2204,11 +2203,15 @@ function comment_form( $args = array(), $post_id = null ) {
'<input id="email" name="email" ' . ( $html5 ? 'type="email"' : 'type="text"' ) . ' value="' . esc_attr( $commenter['comment_author_email'] ) . '" size="30" maxlength="100" aria-describedby="email-notes"' . $html_req . ' /></p>',
'url' => '<p class="comment-form-url"><label for="url">' . __( 'Website' ) . '</label> ' .
'<input id="url" name="url" ' . ( $html5 ? 'type="url"' : 'type="text"' ) . ' value="' . esc_attr( $commenter['comment_author_url'] ) . '" size="30" maxlength="200" /></p>',
'cookies' => '<p class="comment-form-cookies-consent"><input id="wp-comment-cookies-consent" name="wp-comment-cookies-consent" type="checkbox" value="yes"' . $consent . ' />' .
'<label for="wp-comment-cookies-consent">' . __( 'Save my name, email, and website in this browser for the next time I comment.' ) . '</label></p>',
);
$required_text = sprintf( ' ' . __('Required fields are marked %s'), '<span class="required">*</span>' );
if ( has_action( 'set_comment_cookies', 'wp_set_comment_cookies' ) ) {
$consent = empty( $commenter['comment_author_email'] ) ? '' : ' checked="checked"';
$fields['cookies'] = '<p class="comment-form-cookies-consent"><input id="wp-comment-cookies-consent" name="wp-comment-cookies-consent" type="checkbox" value="yes"' . $consent . ' />' .
'<label for="wp-comment-cookies-consent">' . __( 'Save my name, email, and website in this browser for the next time I comment.' ) . '</label></p>';
}
$required_text = sprintf( ' ' . __( 'Required fields are marked %s' ), '<span class="required">*</span>' );
/**
* Filters the default comment form fields.

View File

@ -4,7 +4,7 @@
*
* @global string $wp_version
*/
$wp_version = '4.9.8-alpha-43448';
$wp_version = '4.9.8-alpha-43449';
/**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.