From 5926a70719b366347389b06fd7f61c5dac058e87 Mon Sep 17 00:00:00 2001 From: Peter Westwood Date: Wed, 6 May 2009 20:58:46 +0000 Subject: [PATCH] Allow a plugin to vary the comment cookie lifetime (or even remove the cookies altogether). Fixes #4996. git-svn-id: https://develop.svn.wordpress.org/trunk@11223 602fd350-edb4-49c9-b593-d223f7449a82 --- wp-comments-post.php | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/wp-comments-post.php b/wp-comments-post.php index 8032ed3950..966c5e6d25 100644 --- a/wp-comments-post.php +++ b/wp-comments-post.php @@ -76,9 +76,10 @@ $comment_id = wp_new_comment( $commentdata ); $comment = get_comment($comment_id); if ( !$user->ID ) { - setcookie('comment_author_' . COOKIEHASH, $comment->comment_author, time() + 30000000, COOKIEPATH, COOKIE_DOMAIN); - setcookie('comment_author_email_' . COOKIEHASH, $comment->comment_author_email, time() + 30000000, COOKIEPATH, COOKIE_DOMAIN); - setcookie('comment_author_url_' . COOKIEHASH, clean_url($comment->comment_author_url), time() + 30000000, COOKIEPATH, COOKIE_DOMAIN); + $comment_cookie_lifetime = apply_filters('comment_cookie_lifetime', 30000000); + setcookie('comment_author_' . COOKIEHASH, $comment->comment_author, time() + $comment_cookie_lifetime, COOKIEPATH, COOKIE_DOMAIN); + setcookie('comment_author_email_' . COOKIEHASH, $comment->comment_author_email, time() + $comment_cookie_lifetime, COOKIEPATH, COOKIE_DOMAIN); + setcookie('comment_author_url_' . COOKIEHASH, clean_url($comment->comment_author_url), time() + $comment_cookie_lifetime, COOKIEPATH, COOKIE_DOMAIN); } $location = empty($_POST['redirect_to']) ? get_comment_link($comment_id) : $_POST['redirect_to'] . '#comment-' . $comment_id;