Ticket #18819: block-commenter-cookies.diff
| File block-commenter-cookies.diff, 2.8 KB (added by WhiteJV, 20 months ago) |
|---|
-
wp-comments-post.php
90 90 $comment_id = wp_new_comment( $commentdata ); 91 91 92 92 $comment = get_comment($comment_id); 93 if ( !$user->ID ) { 94 $comment_cookie_lifetime = apply_filters('comment_cookie_lifetime', 30000000); 95 setcookie('comment_author_' . COOKIEHASH, $comment->comment_author, time() + $comment_cookie_lifetime, COOKIEPATH, COOKIE_DOMAIN); 96 setcookie('comment_author_email_' . COOKIEHASH, $comment->comment_author_email, time() + $comment_cookie_lifetime, COOKIEPATH, COOKIE_DOMAIN); 97 setcookie('comment_author_url_' . COOKIEHASH, esc_url($comment->comment_author_url), time() + $comment_cookie_lifetime, COOKIEPATH, COOKIE_DOMAIN); 93 if ( (!defined('BLOCK_COMMENTER_COOKIES')) || (!BLOCK_COMMENTER_COOKIES) ) { 94 if ( !$user->ID ) { 95 $comment_cookie_lifetime = apply_filters('comment_cookie_lifetime', 30000000); 96 setcookie('comment_author_' . COOKIEHASH, $comment->comment_author, time() + $comment_cookie_lifetime, COOKIEPATH, COOKIE_DOMAIN); 97 setcookie('comment_author_email_' . COOKIEHASH, $comment->comment_author_email, time() + $comment_cookie_lifetime, COOKIEPATH, COOKIE_DOMAIN); 98 setcookie('comment_author_url_' . COOKIEHASH, esc_url($comment->comment_author_url), time() + $comment_cookie_lifetime, COOKIEPATH, COOKIE_DOMAIN); 99 } 98 100 } 99 101 100 102 $location = empty($_POST['redirect_to']) ? get_comment_link($comment_id) : $_POST['redirect_to'] . '#comment-' . $comment_id; -
wp-includes/comment.php
1186 1186 // Cookies should already be sanitized. 1187 1187 1188 1188 $comment_author = ''; 1189 if ( isset($_COOKIE['comment_author_'.COOKIEHASH]) )1190 $comment_author = $_COOKIE['comment_author_'.COOKIEHASH];1191 1192 1189 $comment_author_email = ''; 1193 if ( isset($_COOKIE['comment_author_email_'.COOKIEHASH]) )1194 $comment_author_email = $_COOKIE['comment_author_email_'.COOKIEHASH];1195 1196 1190 $comment_author_url = ''; 1197 if ( isset($_COOKIE['comment_author_url_'.COOKIEHASH]) )1198 $comment_author_url = $_COOKIE['comment_author_url_'.COOKIEHASH];1199 1191 1192 if ( (!defined('BLOCK_COMMENTER_COOKIES')) || (!BLOCK_COMMENTER_COOKIES) ) { 1193 if ( isset($_COOKIE['comment_author_'.COOKIEHASH]) ) 1194 $comment_author = $_COOKIE['comment_author_'.COOKIEHASH]; 1195 if ( isset($_COOKIE['comment_author_email_'.COOKIEHASH]) ) 1196 $comment_author_email = $_COOKIE['comment_author_email_'.COOKIEHASH]; 1197 if ( isset($_COOKIE['comment_author_url_'.COOKIEHASH]) ) 1198 $comment_author_url = $_COOKIE['comment_author_url_'.COOKIEHASH]; 1199 } 1200 1200 1201 return apply_filters('wp_get_current_commenter', compact('comment_author', 'comment_author_email', 'comment_author_url')); 1201 1202 } 1202 1203
