Change default sort order on album thumbnails with case "lastalb" Change default sort order on album thumbnails with case "lastalb"
 

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]

Main Menu

Change default sort order on album thumbnails with case "lastalb"

Started by net, July 23, 2009, 09:34:31 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

net

Hi,

I have a slight issue i can't figure out. My default sort order for album thumbnails is set to: DESC, (in CPG config) and it works very nicely when i browse the gallery normally, but for some reason when i call the function "lastalb"
case 'lastalb': // Last albums to which uploads
                if ($META_ALBUM_SET && $CURRENT_CAT_NAME) {
                        $album_name = $lang_meta_album_names['lastalb'].' - '. $CURRENT_CAT_NAME;
                } else {
                        $album_name = $lang_meta_album_names['lastalb'];
                }


                $META_ALBUM_SET = str_replace( "aid", $CONFIG['TABLE_PICTURES'].".aid" , $META_ALBUM_SET );

                $query = "SELECT count({$CONFIG['TABLE_ALBUMS']}.aid) FROM {$CONFIG['TABLE_PICTURES']},{$CONFIG['TABLE_ALBUMS']} WHERE {$CONFIG['TABLE_PICTURES']}.aid = {$CONFIG['TABLE_ALBUMS']}.aid AND approved = 'YES' $META_ALBUM_SET GROUP  BY {$CONFIG['TABLE_PICTURES']}.aid";

                $result = cpg_db_query($query);
                $count = mysql_num_rows($result);
                mysql_free_result($result);

                $query = "SELECT *,{$CONFIG['TABLE_ALBUMS']}.title AS title,{$CONFIG['TABLE_ALBUMS']}.aid AS aid FROM {$CONFIG['TABLE_PICTURES']},{$CONFIG['TABLE_ALBUMS']} WHERE {$CONFIG['TABLE_PICTURES']}.aid = {$CONFIG['TABLE_ALBUMS']}.aid AND approved = 'YES' $META_ALBUM_SET GROUP BY {$CONFIG['TABLE_PICTURES']}.aid ORDER BY {$CONFIG['TABLE_PICTURES']}.ctime DESC $limit";
                $result = cpg_db_query($query);
                $rowset = cpg_db_fetch_rowset($result);
                mysql_free_result($result);

                if ($set_caption) build_caption($rowset,array('ctime'));

                $rowset = CPGPluginAPI::filter('thumb_caption_lastalb',$rowset);

                return $rowset;
                break;


the album thumbnails are sorted by ASC which means the first picture created in the album is the one displayed. I want it to sort by DESC so that the last picture created in the album is displayed as the album thumbnail.

Any ideas how i can change the case "lastalb" to do this for me? I can't seem to figure it out. I don't use "lastalb" as a function to display albums on the index page, i'm using it as a button to see the latest updates albums. The link i use to call the function is "thumbnails.php?album=lastalb", i don't know if that matters at all, but the more information the better i though!

Thanks for the support.


net

http://tinyurl.com/nf9pdg <- NOT SAFE FOR WORK

Click any album to see that the thumbnail used is the first uploaded picture into that album, i want it to be the other way around that the latest or newest picture created in album is the thumbnail. Which i have when you browse through normal categories.

Joachim Müller

I'm not going to follow an tinyurl link. Post the real link or don't post at all.

net

Well i don't want unwanted google attention, so i won't post then.