coppermine-gallery.com/forum

Support => cpg1.4.x Support => Older/other versions => cpg1.4 miscellaneous => Topic started by: zom on February 19, 2006, 12:50:59 AM

Title: limit number of comments
Post by: zom on February 19, 2006, 12:50:59 AM
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 
Title: Re: limit number of comments
Post by: isloera on February 26, 2006, 06:29:54 AM
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");
Title: Re: limit number of comments
Post by: Stramm on February 26, 2006, 04:05:51 PM
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)
Title: Re: limit number of comments
Post by: zom on April 23, 2006, 05:58:58 PM
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