• Resolved snoogly

    (@snoogly)


    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?

Viewing 7 replies - 1 through 7 (of 7 total)
  • Don’t worry: everybody sees only their own name and address because of the cookies. Other users don’t see it ??

    Thread Starter snoogly

    (@snoogly)

    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.

    Thread Starter snoogly

    (@snoogly)

    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?!

    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….

    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.

    Thread Starter snoogly

    (@snoogly)

    Thanks a lot for the help!

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘How can I get the name and email fields in comment form to empty after submit?’ is closed to new replies.