WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] How can I get the name and email fields in comment form to empty after submit? (8 posts)

  1. snoogly
    Member
    Posted 8 years ago #

    I need the name and email fields in the comments form to empty after a user submits a comment. Can someone tell me how to do it?

  2. moshu
    Member
    Posted 8 years ago #

    Don't worry: everybody sees only their own name and address because of the cookies. Other users don't see it :)

  3. snoogly
    Member
    Posted 8 years ago #

    Ah, but my site will be used in a public area, where for ease of use nobody has to log in. It will be used in a university self-access access centre for students to post comments about books they have read. It needs to be kept as open and easy to use as possible. Therefore, I really need the user's personal info to be cleared after submitting a comment.

  4. snoogly
    Member
    Posted 8 years ago #

    Does anyone have any ideas about this? For me this is a make or break point, and I may have to switch from the WordPress platform if I can't find a way to do it. I really don't want to do that - so can someone please throw me a bone?!

  5. vkaryl
    Member
    Posted 8 years ago #

    There's probably a way to clear the form after submit; I'm not particularly apt with either php or forms, and can't tell you what to do to the commments form in comments.php to accomplish that. You might look at other sorts of input forms, to see how they "empty" when submitted....

  6. carthik
    Member
    Posted 8 years ago #

    In wp-comments-post.php find these lines:
    wp_new_comment($commentdata);
    setcookie('comment_author_' . COOKIEHASH, stripslashes($comment_author), time() + 30000000, COOKIEPATH);
    setcookie('comment_author_email_' . COOKIEHASH, stripslashes($comment_author_email), time() + 30000000, COOKIEPATH);
    setcookie('comment_author_url_' . COOKIEHASH, stripslashes($comment_author_url),time() + 30000000, COOKIEPATH);

    and change all occurences of time() + 30000000 to time() - 300000000

    Can't think of any easy way to put this in a plugin, I'm sure there will be way, though.

  7. carthik
    Member
    Posted 8 years ago #

  8. snoogly
    Member
    Posted 8 years ago #

    Thanks a lot for the help!

Topic Closed

This topic has been closed to new replies.

About this Topic