WordPress.org

Ready to get started?Download WordPress

Forums

how to disable comments form cookies (4 posts)

  1. misieg7
    Member
    Posted 7 years ago #

    Hi there,

    I wonder if there is a plugin or some kind of solution to add a following checkbox to comment form:

    do not store my e-mail and name on this computer

    Clicking on this checkbox would allow to disable storing of autor e-mail and name cookies.

    Any suggestions?

  2. mmwp99
    Member
    Posted 6 years ago #

    And I'd like to just disable it across the board (so that past commenters could get a quickly delivered page from the wp-cache plugin).

  3. Samuel Wood (Otto)
    Tech Ninja
    Posted 6 years ago #

    Huh. Nobody's asked for that one that I can find.

    Anyway, edit wp-comments-post.php and remove these lines at the bottom of the file:

    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);
    }
  4. lcwallis
    Member
    Posted 6 years ago #

    I tried commenting out the above code in wp-comments-post.php, and when I tried to post a comment, I received this error:

    Warning: Cannot modify header information - headers already sent by (output started at [blog directory]/wp-comments-post.php:2) in [blog directory]/wp-includes/pluggable.php on line 391

    We do not want to set cookies for commenters, though we want to collect name and email information. Any other ideas?

Topic Closed

This topic has been closed to new replies.

About this Topic