limit number of comments limit number of comments
 

News:

CPG Release 1.6.27
change DB IP storage fields to accommodate IPv6 addresses
remove use of E_STRICT (PHP 8.4 deprecated)
update README to reflect new website
align code with new .com CPG website
correct deprecation in captcha

Main Menu

limit number of comments

Started by zom, February 19, 2006, 12:50:59 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

zom

I use to limit the number of comments by modifing displayimage.php file

$result_prelim = db_query("SELECT msg_id, msg_author, msg_body, UNIX_TIMESTAMP(msg_date) AS msg_date, author_id, author_md5_id, msg_raw_ip, msg_hdr_ip FROM {$CONFIG['TABLE_COMMENTS']} WHERE pid='$pid' ORDER BY msg_id ASC");
$numrows = (max(mysql_num_rows($result_prelim) - 10,0));
$result = db_query("SELECT msg_id, msg_author, msg_body, UNIX_TIMESTAMP(msg_date) AS msg_date, author_id, author_md5_id, msg_raw_ip, msg_hdr_ip FROM {$CONFIG['TABLE_COMMENTS']} WHERE pid='$pid' ORDER BY msg_id ASC LIMIT " .$numrows. ",10");


but I don't find the initial commend in coppermine 1.4.

More I would like to keep in database only the 40 last comments by picture.

Could help ?

thanks 
Thanks to everyone

isloera

I believe the code you're trying to find now is part of the file include/themes.inc.php

The line of code seems to be

$result = cpg_db_query("SELECT msg_id, msg_author, msg_body, UNIX_TIMESTAMP(msg_date) AS msg_date, author_id, author_md5_id, msg_raw_ip, msg_hdr_ip, pid FROM {$CONFIG['TABLE_COMMENTS']} WHERE pid='$pid' ORDER BY msg_id $comment_sort_order");

Stramm

an in db_input.php
here you need to query for the number of comments for a pic when a new comment gets added. If > max comments then delete oldest (in case you still want to delete the oldest comments)

zom

Thank you for your information.

I understand that with a hack of db_input.php file the new comment could errase the oldest comments with a maximum o number (70 for me) of comments per image that I could choose.

Unfortunately, I am not a php tech so could you help me in the hack I should do to have this result,


very many thanks for that 
Thanks to everyone