Managing Comments?

Random stuff about serendipity. Discussion, Questions, Paraphernalia.
Post Reply
cc
Posts: 4
Joined: Fri Dec 05, 2003 6:38 pm
Location: New Amsterdam

Managing Comments?

Post 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.
munk
Regular
Posts: 15
Joined: Tue Dec 09, 2003 6:25 pm
Contact:

Post 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.
cc
Posts: 4
Joined: Fri Dec 05, 2003 6:38 pm
Location: New Amsterdam

Post 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.
munk
Regular
Posts: 15
Joined: Tue Dec 09, 2003 6:25 pm
Contact:

Post by munk »

Try functions.inc.php :P
cc
Posts: 4
Joined: Fri Dec 05, 2003 6:38 pm
Location: New Amsterdam

Post by cc »

Sweet crack rat! It worked :!:

Thank you so much.
Post Reply