Grouping comments for the same pic in lastcom - Page 2 Grouping comments for the same pic in lastcom - Page 2
 

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

Main Menu

Grouping comments for the same pic in lastcom

Started by Pastinakel, August 22, 2006, 01:17:36 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

qdinar

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.

dwo

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.

TripleFi 10


pilgrim13

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!

Cmaniac

It is definitely something that CPG 1.5 needs  ;)

Cmaniac

And I have implemented it.

In functions.inc.php after

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

        $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

        $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.

Cmaniac

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

ΑndrĂ©