coppermine-gallery.com/forum

Support => cpg1.4.x Support => Older/other versions => cpg1.4 miscellaneous => Topic started by: dEnA on February 07, 2006, 05:33:16 PM

Title: Sort albums alphabettically
Post by: dEnA on February 07, 2006, 05:33:16 PM
Hi, I have tried search and didnt find the solution for my easy problem.

http://motorfreaks.org/gallery/index.php?cat=1&page=1

I want theese albums to be automatically sort by users name alphabetically
Not by when theyre mabe like it's now
Thanks in advance
Title: Re: Sort albums alphabettically
Post by: Stramm on February 07, 2006, 06:18:03 PM
in index.php find the function list_users

replace the var $sql with

       $sql = "SELECT owner_id as user_id, " .
               "owner_name as user_name, " .
               "COUNT(DISTINCT a.aid) as alb_count, " .
               "COUNT(DISTINCT pid) as pic_count, " .
               "MAX(pid) as thumb_pid " .
               "FROM {$CONFIG['TABLE_ALBUMS']} AS a  " .
               "INNER JOIN {$CONFIG['TABLE_PICTURES']} AS p ON (p.aid = a.aid AND approved = 'YES') ";
        if ($FORBIDDEN_SET != "") $sql .= "WHERE $FORBIDDEN_SET ";
        $sql .= "AND category >= " . FIRST_USER_CAT . " GROUP BY user_id " .
                //"ORDER BY thumb_pid DESC"; // order by last uploaded
                "ORDER BY user_name ASC"; // order by user name


edit: sorry, thought I'm in the 1.3 support board... therefore this is only valid for 1.3x
Title: Re: Sort albums alphabettically
Post by: Nibbler on February 07, 2006, 06:31:35 PM
http://forum.coppermine-gallery.net/index.php?topic=24420.0