WordPress.org

Ready to get started?Download WordPress

Forums

"Welcome commenter, this post have a new comment" (1 post)

  1. Dunkkan
    Member
    Posted 4 years ago #

    Hello guys,

    I've been trying to find some snippet to add to my loop, next to comment_popup, so a returning commenter finds a little message saying that the post got new comments since his last reply...

    I found this plugin : http://wordpress.org/extend/plugins/new-posts-popup/

    , but it works overall with posts ("There Are New Posts!"), and is too much for what I need, and trying to read its code is excessive to my knowdledge.

    I found later this nice code :

    <?php if(isset($_COOKIE['comment_author_'.COOKIEHASH])) {
    $lastCommenter = $_COOKIE['comment_author_'.COOKIEHASH];
    
    echo "Hello again ". $lastCommenter ."!";
    
    } else {
    
    echo "Welcome to our site!";
    } ?>

    , which checks for the cookie stored by the user when that one lets a comment, then prints one thing or the other if the user is identified.

    So I would go rather to something similar, but adding some Boolean Operator like :

    if this user is cookied, AND there's a new comment since his last visit, print a message

    Thanks for any input here guys.

Topic Closed

This topic has been closed to new replies.

About this Topic