forum.coppermine-gallery.net

Support => cpg1.4.x Support => Older/other versions => cpg1.4 miscellaneous => Topic started by: net on July 23, 2009, 09:34:31 pm

Title: Change default sort order on album thumbnails with case "lastalb"
Post by: net on July 23, 2009, 09:34:31 pm
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"
Code: [Select]
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.
Title: Re: Change default sort order on album thumbnails with case "lastalb"
Post by: Joachim Müller on July 24, 2009, 09:39:23 am
http://forum.coppermine-gallery.net/index.php/topic,55415.msg270616.html#msg270616
Title: Re: Change default sort order on album thumbnails with case "lastalb"
Post by: net on July 24, 2009, 11:02:38 am
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.
Title: Re: Change default sort order on album thumbnails with case "lastalb"
Post by: Joachim Müller on July 24, 2009, 01:48:06 pm
I'm not going to follow an tinyurl link. Post the real link or don't post at all.
Title: Re: Change default sort order on album thumbnails with case "lastalb"
Post by: net on July 24, 2009, 02:09:59 pm
Well i don't want unwanted google attention, so i won't post then.