coppermine-gallery.com/forum

Support => Older/other versions => cpg1.2 Standalone Support => Topic started by: turtleboy on April 07, 2004, 04:28:35 PM

Title: Sorting Sub-categories (user galleries) by date
Post by: turtleboy on April 07, 2004, 04:28:35 PM
I searched, tried the things I found in search, nothing worked.

How do you sort the user categories in order of date created with the earliest album first in each category? (sorting the list of users galleries)
Title: Sorting Sub-categories (user galleries) by date
Post by: photoman13 on April 07, 2004, 04:33:31 PM
do a search for albums AND order (http://forum.coppermine-gallery.net/index.php?topic=29&highlight=albums+order) and this is what ya find :)
Title: Sorting Sub-categories (user galleries) by date
Post by: Casper on April 07, 2004, 06:14:04 PM
See if this thread helps, http://forum.coppermine-gallery.net/index.php?topic=1379&postdays=0&postorder=asc&highlight=order+date&start=0

It is not straight forward, as the user galleries page is actually showing sub-categories, and the albums are on the sub-cat page.
Title: Sorting Sub-categories (user galleries) by date
Post by: turtleboy on April 08, 2004, 06:23:08 AM
Yea already tried all that out, seems like it only orders the albums in the categories.. not the sub categories.

Anyone else have a solution? The default is alphabetic.
Title: Sorting Sub-categories (user galleries) by date
Post by: turtleboy on April 09, 2004, 10:38:12 PM
Ok I did some database browsing and tried my hand at php, and finally got the sub cats (user galleries) to sort in different orders, I can post what I did if anyone wants to know.
Title: Sorting Sub-categories (user galleries) by date
Post by: Casper on April 09, 2004, 10:40:01 PM
Please do, all tips and tricks are welcome, and will no doubt be just what someone else will also want.  :wink:
Title: Sorting Sub-categories (user galleries) by date
Post by: turtleboy on April 09, 2004, 11:18:04 PM
Alright here's what I did:

On line 216 of index.php:
        $sql = "SELECT user_id," . "                user_name," . "                COUNT(DISTINCT a.aid) as alb_count," . "                COUNT(DISTINCT pid) as pic_count," . "                MAX(pid) as thumb_pid " . "FROM {$CONFIG['TABLE_USERS']} AS u " . "INNER JOIN {$CONFIG['TABLE_ALBUMS']} AS a ON category = " . FIRST_USER_CAT . " + user_id " . "INNER JOIN {$CONFIG['TABLE_PICTURES']} AS p ON p.aid = a.aid " . "WHERE approved = 'YES' " . "$FORBIDDEN_SET " . "GROUP BY user_id " . "ORDER BY user_name ";

The red part is what you edit.
The values you can change it to are:
Title: Re: Sorting Sub-categories (user galleries) by date
Post by: turtleboy on June 11, 2004, 11:00:58 PM
Just a quick update, if anyone wants to do this on 1.3.0 the code is one line 295 of index.php