| 1 | Index: wp-comments-post.php |
|---|
| 2 | =================================================================== |
|---|
| 3 | --- wp-comments-post.php (revision 18391) |
|---|
| 4 | +++ wp-comments-post.php (working copy) |
|---|
| 5 | @@ -91,10 +91,7 @@ |
|---|
| 6 | |
|---|
| 7 | $comment = get_comment($comment_id); |
|---|
| 8 | if ( !$user->ID ) { |
|---|
| 9 | - $comment_cookie_lifetime = apply_filters('comment_cookie_lifetime', 30000000); |
|---|
| 10 | - setcookie('comment_author_' . COOKIEHASH, $comment->comment_author, time() + $comment_cookie_lifetime, COOKIEPATH, COOKIE_DOMAIN); |
|---|
| 11 | - setcookie('comment_author_email_' . COOKIEHASH, $comment->comment_author_email, time() + $comment_cookie_lifetime, COOKIEPATH, COOKIE_DOMAIN); |
|---|
| 12 | - setcookie('comment_author_url_' . COOKIEHASH, esc_url($comment->comment_author_url), time() + $comment_cookie_lifetime, COOKIEPATH, COOKIE_DOMAIN); |
|---|
| 13 | + wp_set_comment_cookie($comment->comment_author,$comment->comment_author_email,$comment->comment_author_url); |
|---|
| 14 | } |
|---|
| 15 | |
|---|
| 16 | $location = empty($_POST['redirect_to']) ? get_comment_link($comment_id) : $_POST['redirect_to'] . '#comment-' . $comment_id; |
|---|
| 17 | Index: wp-includes/pluggable.php |
|---|
| 18 | =================================================================== |
|---|
| 19 | --- wp-includes/pluggable.php (revision 18391) |
|---|
| 20 | +++ wp-includes/pluggable.php (working copy) |
|---|
| 21 | @@ -1809,3 +1809,23 @@ |
|---|
| 22 | return $r; |
|---|
| 23 | } |
|---|
| 24 | endif; |
|---|
| 25 | + |
|---|
| 26 | +if ( !function_exists('wp_set_comment_cookie') ) : |
|---|
| 27 | +/** |
|---|
| 28 | + * Sets the cookies used to store an unauthenticated commentator's identity. Typically used |
|---|
| 29 | + * to recall previous comments by this commentator that are still held in moderation. |
|---|
| 30 | + * |
|---|
| 31 | + * @param string $author Comment author's name |
|---|
| 32 | + * @param string $email Comment author's e-mail address |
|---|
| 33 | + * @param string $url Comment author's URL (typically optional) |
|---|
| 34 | + * |
|---|
| 35 | + * @uses apply_filters() Calls 'comment_cookie_lifetime' to adjust lifetime of these cookies |
|---|
| 36 | + * |
|---|
| 37 | + */ |
|---|
| 38 | +function wp_set_comment_cookie($author,$email,$url) { |
|---|
| 39 | + $comment_cookie_lifetime = apply_filters('comment_cookie_lifetime', 30000000); |
|---|
| 40 | + setcookie('comment_author_' . COOKIEHASH, $author, time() + $comment_cookie_lifetime, COOKIEPATH, COOKIE_DOMAIN); |
|---|
| 41 | + setcookie('comment_author_email_' . COOKIEHASH, $email, time() + $comment_cookie_lifetime, COOKIEPATH, COOKIE_DOMAIN); |
|---|
| 42 | + setcookie('comment_author_url_' . COOKIEHASH, esc_url($url), time() + $comment_cookie_lifetime, COOKIEPATH, COOKIE_DOMAIN); |
|---|
| 43 | +} |
|---|
| 44 | +endif; |
|---|