Advanced search  

News:

cpg1.5.48 Security release - upgrade mandatory!
The Coppermine development team is releasing a security update for Coppermine in order to counter a recently discovered vulnerability. It is important that all users who run version cpg1.5.46 or older update to this latest version as soon as possible.
[more]

Pages: [1]   Go Down

Author Topic: limit number of comments  (Read 2913 times)

0 Members and 1 Guest are viewing this topic.

zom

  • Coppermine regular visitor
  • **
  • Offline Offline
  • Posts: 83
limit number of comments
« on: February 19, 2006, 12:50:59 am »

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

Code: [Select]
$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 
« Last Edit: February 19, 2006, 01:03:34 am by Nibbler »
Logged
Thanks to everyone

isloera

  • Contributor
  • Coppermine novice
  • ***
  • Offline Offline
  • Gender: Male
  • Posts: 22
    • Calvilloweb.com
Re: limit number of comments
« Reply #1 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

Code: [Select]
$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");
Logged

Stramm

  • Dev Team member
  • Coppermine addict
  • ****
  • Country: 00
  • Offline Offline
  • Gender: Male
  • Posts: 6006
    • Bettis Wollwelt
Re: limit number of comments
« Reply #2 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)

zom

  • Coppermine regular visitor
  • **
  • Offline Offline
  • Posts: 83
Re: limit number of comments
« Reply #3 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 
Logged
Thanks to everyone
Pages: [1]   Go Up
 

Page created in 0.017 seconds with 20 queries.