Page 1 of 1

Managing Comments?

Posted: Thu Dec 11, 2003 5:01 am
by cc
Can we? Not sure if I'll need to, but it would be nice to know how someone deals with comments they want to clean up, erase, ban. Speaking of which, is it possible to read a comment's IP?

Thanks.

Posted: Thu Dec 11, 2003 8:03 pm
by munk
Doesn't look like there's a way to edit comments eh? The only thing I can see is an option to delete the comment if you're logged in as an admin - in the popup when you choose to view the comment.

As far as the IP address details, it looks like there's a field for ip address in the comments table in the db, but it doesn't actually get used :(

Looking at the code you could add the ip by modifying lines 980-981 in comments.php:

Code: Select all

    $query  = "INSERT INTO {$serendipity['dbPrefix']}comments (entry_id, author, email, url, ip, body, type, timestamp, title, subscribed)";
    $query .= " VALUES ('$id', '$name', '$email', '$url', '".$_SERVER['REMOTE_ADDR']."', '$commentsFixed', '$type', '$t', '$title', '$subscribe')";
and modifying line 909 in the serendipity_functions.inc.php file to display the IP (only if you're logged in as admin):

Code: Select all

            echo ' (<a href="' . $serendipity['baseURL'] .  'comment.php?serendipity[delete]=' . $comment['id'] .  '&serendipity[entry]=' . $comment['entry_id'] .  '&serendipity[type]=comments">' . DELETE . '</a>) IP:'.(isset($comment['ip']) ? $comment['ip'] : "&");
Note the last '&' in the above should actually be '& emdash ;' (without the spaces!).

Semi-tested.

Posted: Thu Dec 11, 2003 10:23 pm
by cc
Interesting!

As you can probably tell, I'm not so familiar with PHP. But when looking in my dir, I don't have a 980+ line comments.php file. Instead, I have a 130 line comment.php file.. so I'm a bit lost.

Posted: Thu Dec 11, 2003 10:29 pm
by munk
Try functions.inc.php :P

Posted: Thu Dec 11, 2003 10:58 pm
by cc
Sweet crack rat! It worked :!:

Thank you so much.