Sorting Sub-categories (user galleries) by date Sorting Sub-categories (user galleries) by date
 

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

Sorting Sub-categories (user galleries) by date

Started by turtleboy, April 07, 2004, 04:28:35 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

turtleboy

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)

photoman13


Casper

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.
It has been a long time now since I did my little bit here, and have done no coding or any other such stuff since. I'm back to being a noob here

turtleboy

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.

turtleboy

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.

Casper

Please do, all tips and tricks are welcome, and will no doubt be just what someone else will also want.  :wink:
It has been a long time now since I did my little bit here, and have done no coding or any other such stuff since. I'm back to being a noob here

turtleboy

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:
  • user_name (alphabetically by user name)
  • user_id (the ID of the user, the first user (you) is 1 , and every one after that is numbered sequentially according to when they registered, sorts numerically)
  • user_lastvisit (order them by last visit date (although some users in my db are all 00:00:00 so I don't know how well this one will work)
  • user_regdate (orders them by their registration date, i think this is pretty much the same as user_id)[/list:u]
    There are other values you can use, but none of them would seem to be very useful.