Advanced search  

News:

CPG Release 1.6.26
Correct PHP8.2 issues with user and language managers.
Additional fixes for PHP 8.2
Correct PHP8 error with SMF 2.0 bridge.
Correct IPTC supplimental category parsing.
Download and info HERE

Pages: [1]   Go Down

Author Topic: help with comments  (Read 3798 times)

0 Members and 1 Guest are viewing this topic.

zom

  • Coppermine regular visitor
  • **
  • Offline Offline
  • Posts: 83
help with comments
« on: April 26, 2006, 09:32:16 pm »

I have change line 2323 in theme.inc to limit the number of comments to 20 :

 $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 LIMIT 20");

But I wuold like the lasts comment to be shown, how to do that ?

Could it be possible to errase oldest comments when a new one is entered ?

thanks

« Last Edit: April 30, 2006, 09:39:40 am by GauGau »
Logged
Thanks to everyone

Nibbler

  • Guest
Re: help with comments
« Reply #1 on: April 26, 2006, 09:34:35 pm »

Change

Code: [Select]
ORDER BY msg_id
to

Code: [Select]
ORDER BY msg_id DESC
Logged

zom

  • Coppermine regular visitor
  • **
  • Offline Offline
  • Posts: 83
Re: help with comments
« Reply #2 on: April 27, 2006, 07:39:24 am »

thanks foryour help, but adding "DESC" :

author_id, author_md5_id, msg_raw_ip, msg_hdr_ip, pid FROM {$CONFIG['TABLE_COMMENTS']} WHERE pid='$pid' ORDER BY msg_id DESC $comment_sort_order LIMIT 50"

gives me an error : error of request
Logged
Thanks to everyone

Stramm

  • Dev Team member
  • Coppermine addict
  • ****
  • Country: 00
  • Offline Offline
  • Gender: Male
  • Posts: 6006
    • Bettis Wollwelt
Re: help with comments
« Reply #3 on: April 29, 2006, 09:17:28 am »

of course you should remove then the variable that holds the sort order... otherwise you have it double in the satatment what leads to an error

ORDER BY msg_id DESC LIMIT 20

zom

  • Coppermine regular visitor
  • **
  • Offline Offline
  • Posts: 83
Re: help with comments
« Reply #4 on: April 29, 2006, 02:40:06 pm »

many thanks for your help !

to remove older comments than the last 50 ones is a way to do it (even if it is manually by a mysql request in php myadmin) ?
Logged
Thanks to everyone

Joachim Müller

  • Dev Team member
  • Coppermine addict
  • ****
  • Offline Offline
  • Gender: Male
  • Posts: 47843
  • aka "GauGau"
    • gaugau.de
Re: help with comments
« Reply #5 on: April 30, 2006, 09:39:30 am »

Logged
Pages: [1]   Go Up
 

Page created in 0.024 seconds with 20 queries.