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

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

git-svn-id: https://develop.svn.wordpress.org/trunk@42772 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Andrew Ozz
2018-03-04 16:40:43 +00:00
parent 37acff86ca
commit 65d8fe578a
4 changed files with 32 additions and 15 deletions

View File

@@ -38,16 +38,18 @@ if ( is_wp_error( $comment ) ) {
}
$user = wp_get_current_user();
$cookies_consent = ( isset( $_POST['wp-comment-cookies-consent'] ) );
/**
* Perform other actions when comment cookies are set.
*
* @since 3.4.0
*
* @param WP_Comment $comment Comment object.
* @param WP_User $user User object. The user may not exist.
* @param WP_Comment $comment Comment object.
* @param WP_User $user User object. The user may not exist.
* @param boolean $cookies_consent Whether the user has opted-in commenter cookies.
*/
do_action( 'set_comment_cookies', $comment, $user );
do_action( 'set_comment_cookies', $comment, $user, $cookies_consent );
$location = empty( $_POST['redirect_to'] ) ? get_comment_link( $comment ) : $_POST['redirect_to'] . '#comment-' . $comment->comment_ID;