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 [2]   Go Down

Author Topic: Grouping comments for the same pic in lastcom  (Read 44350 times)

0 Members and 1 Guest are viewing this topic.

qdinar

  • Coppermine newbie
  • Offline Offline
  • Posts: 15
Re: Grouping comments for the same pic in lastcom
« Reply #20 on: May 03, 2009, 03:22:32 pm »

one more bug of last comments code that is in Reply #14 : when [you](?) open category or album, last comments stay as it is on the frontpage, while last comments' title says "last comments - category of something" and built-in (default,original,standard) code showed here only comments of images that are in currently being viewed category or album.
Logged

dwo

  • Coppermine frequent poster
  • ***
  • Offline Offline
  • Posts: 143
Re: Grouping comments for the same pic in lastcom
« Reply #21 on: September 26, 2009, 10:25:25 pm »

Finally I found one problem with the code.

"last comments" shows all comments. This means the comments on private albums, too. It should hide them.

Is there any way to fix that?

Thank you very much.
Logged

TripleFi 10

  • Coppermine newbie
  • Offline Offline
  • Posts: 2
    • opinions about products : Ultimate Ears TripleFi 10 Noise Isolating Earphones
Re: Grouping comments for the same pic in lastcom
« Reply #22 on: May 26, 2011, 04:28:39 am »

Thank you and best regards :)
Logged
"Ultimate Ears TripleFi 10":http://ultimateearstriple-f10.blogspot.com/
"Howard Leight R-01526":http://howardleight-r01526.blogspot.com/
"Porter Cable 557":http://portercable557.wordpress.com/

pilgrim13

  • Coppermine newbie
  • Offline Offline
  • Posts: 7
Re: Grouping comments for the same pic in lastcom
« Reply #23 on: June 14, 2011, 09:26:59 pm »

Hello, somebody knows how to adapt it for version 1.5.h. The problem stems from the fact that this version is used msg_id?

Thank you for your help!
Logged

Cmaniac

  • Coppermine novice
  • *
  • Offline Offline
  • Posts: 40
Re: Grouping comments for the same pic in lastcom
« Reply #24 on: June 18, 2011, 07:11:04 pm »

It is definitely something that CPG 1.5 needs  ;)
Logged

Cmaniac

  • Coppermine novice
  • *
  • Offline Offline
  • Posts: 40
Re: Grouping comments for the same pic in lastcom
« Reply #25 on: July 09, 2011, 11:25:32 pm »

And I have implemented it.

In functions.inc.php after

Code: [Select]
if ($cat && $CURRENT_CAT_NAME) {
            $album_name = cpg_fetch_icon('comment', 2) . $album_name = $lang_meta_album_names['lastcom'] . ' - ' . $CURRENT_CAT_NAME;
        } else {
            $album_name = cpg_fetch_icon('comment', 2) . $lang_meta_album_names['lastcom'];
        }

The $query becomes

Code: [Select]
        $query = "SELECT COUNT(DISTINCT(r.pid))
                FROM {$CONFIG['TABLE_COMMENTS']} AS c
                INNER JOIN {$CONFIG['TABLE_PICTURES']} AS r ON r.pid = c.pid
                INNER JOIN {$CONFIG['TABLE_ALBUMS']} AS a ON a.aid = r.aid
                $RESTRICTEDWHERE
                AND r.approved = 'YES'
                AND c.approval = 'YES'";

And after

Quote
$select_columns = implode(', ', $select_column_list);

the $query becomes

Code: [Select]
        $query = "SELECT * FROM (SELECT $select_columns
                FROM {$CONFIG['TABLE_COMMENTS']} AS c
                INNER JOIN {$CONFIG['TABLE_PICTURES']} AS r ON r.pid = c.pid
                INNER JOIN {$CONFIG['TABLE_ALBUMS']} AS a ON a.aid = r.aid
                $RESTRICTEDWHERE
                AND r.approved = 'YES'
                AND c.approval = 'YES'
ORDER BY msg_id $DESC) AS c
GROUP BY c.pid
                ORDER BY msg_id $DESC
                $limit";

That's all. I am no coding expert but I've found out that it works and I'm happy to share it. :)

I take no responsibility if it doesn't work as expected.
Logged

Cmaniac

  • Coppermine novice
  • *
  • Offline Offline
  • Posts: 40
Re: Grouping comments for the same pic in lastcom
« Reply #26 on: July 09, 2011, 11:31:15 pm »

Well, it doesn't. I will come back later if I find any other solution.
Logged

Αndré

  • Administrator
  • Coppermine addict
  • *****
  • Country: de
  • Offline Offline
  • Gender: Male
  • Posts: 15764
Re: Grouping comments for the same pic in lastcom
« Reply #27 on: November 17, 2011, 03:38:12 pm »

FYI: this meta album has been added to the "More Meta Albums" plugin in version 1.7.
Logged
Pages: 1 [2]   Go Up
 

Page created in 0.02 seconds with 20 queries.