[wp-hackers] Forget Commenter's Info
Mark Jaquith
mark.wordpress at txfx.net
Tue Oct 12 03:41:19 UTC 2004
I wrote this hack for an optional "forget_cookie" option in the comments
form that will prevent the commenter's info from being saved to a cookie
(for public computer situations). I also wrote a function to manually
forget a user's info (without submitting a comment) in the case that a
user sees that their info has been saved and wants to get rid of it.
The first part is about 4 extra lines of code in wp-comments-post.php
Carthik thought it might be worth putting in the core, but honestly I
kind of forgot about it until now.
http://www.scriptygoddess.com/archives/2004/06/29/forget-user-info/
Included is a patch for current CVS with slightly updated code (using
COOKIEPATH instead of $cookiepath, mostly).
-------------- next part --------------
Index: wp-comments-post.php
===================================================================
RCS file: /cvsroot/cafelog/wordpress/wp-comments-post.php,v
retrieving revision 1.19
diff -u -r1.19 wp-comments-post.php
--- wp-comments-post.php 11 Oct 2004 22:07:09 -0000 1.19
+++ wp-comments-post.php 12 Oct 2004 03:38:49 -0000
@@ -87,9 +87,15 @@
wp_notify_postauthor($comment_ID, 'comment');
}
+if($_POST['forget_cookie'] == 'forget'){
+setcookie('comment_author_' . COOKIEHASH, '', time()-60000, COOKIEPATH);
+setcookie('comment_author_email_' . COOKIEHASH, '', time()-60000, COOKIEPATH);
+setcookie('comment_author_url_' . COOKIEHASH, '', time()-60000, COOKIEPATH);
+} else {
setcookie('comment_author_' . COOKIEHASH, stripslashes($author), time() + 30000000, COOKIEPATH);
setcookie('comment_author_email_' . COOKIEHASH, stripslashes($email), time() + 30000000, COOKIEPATH);
setcookie('comment_author_url_' . COOKIEHASH, stripslashes($url), time() + 30000000, COOKIEPATH);
+}
header('Expires: Mon, 26 Jul 1997 05:00:00 GMT');
header('Last-Modified: ' . gmdate('D, d M Y H:i:s') . ' GMT');
More information about the hackers
mailing list