coppermine-gallery.com/forum

Support => cpg1.5.x Support => cpg1.5 miscellaneous => Topic started by: paulgul on November 07, 2010, 12:52:55 PM

Title: Last uploads album
Post by: paulgul on November 07, 2010, 12:52:55 PM
My gallery http://www.paulgulliver.co.uk/Coppermine/index.php?cat=0
How many files are held in the last uploads album. When I can on mine (from the album menu) I seem to get all the uploads I've done across several pages
Title: Re: Last uploads album
Post by: Nibbler on November 07, 2010, 12:54:16 PM
Yes, that's how it works.
Title: Re: Last uploads album
Post by: paulgul on November 07, 2010, 02:00:17 PM
Ok, I just assumed it would show the last 'X' number of thumbnails and then remove older ones as new ones were uploaded. I was hoping to set it up to show those uploaded in, say, the last 30 days so that returning users would be find new uploads quickly.
Title: Re: Last uploads album
Post by: Αndré on November 07, 2010, 06:51:24 PM
You have to modify the appropriate queries in include/functions.inc.php. Search for 'lastup' (including the quotation marks).
Title: Re: Last uploads album
Post by: paulgul on November 07, 2010, 10:13:23 PM
Quote from: Αndré on November 07, 2010, 06:51:24 PM
You have to modify the appropriate queries in include/functions.inc.php.
If anyone could offer some help here in modifing the query. that would be appreciated
Paul
Title: Re: Last uploads album
Post by: Αndré on November 08, 2010, 09:55:16 AM
Find
        $query = "SELECT COUNT(*)
                FROM {$CONFIG['TABLE_PICTURES']} AS r
                INNER JOIN {$CONFIG['TABLE_ALBUMS']} AS a ON a.aid = r.aid
                $RESTRICTEDWHERE
                AND approved = 'YES'";

and replace with
        $query = "SELECT COUNT(*)
                FROM {$CONFIG['TABLE_PICTURES']} AS r
                INNER JOIN {$CONFIG['TABLE_ALBUMS']} AS a ON a.aid = r.aid
                $RESTRICTEDWHERE
                AND approved = 'YES'
                AND ctime > UNIX_TIMESTAMP() - 60*60*24*30";



Find
        $query = "SELECT $select_columns
                FROM {$CONFIG['TABLE_PICTURES']} AS r
                INNER JOIN {$CONFIG['TABLE_ALBUMS']} AS a ON a.aid = r.aid
                $RESTRICTEDWHERE
                AND approved = 'YES'
                ORDER BY r.pid $DESC $limit";

and replace with
        $query = "SELECT $select_columns
                FROM {$CONFIG['TABLE_PICTURES']} AS r
                INNER JOIN {$CONFIG['TABLE_ALBUMS']} AS a ON a.aid = r.aid
                $RESTRICTEDWHERE
                AND approved = 'YES'
                AND ctime > UNIX_TIMESTAMP() - 60*60*24*30
                ORDER BY r.pid $DESC $limit";



Find
        $query = "SELECT COUNT(*) FROM {$CONFIG['TABLE_PICTURES']} AS p
            INNER JOIN {$CONFIG['TABLE_ALBUMS']} AS r ON r.aid = p.aid
            $RESTRICTEDWHERE
            AND approved = 'YES'
            AND pid > $pid";

and replace with
        $query = "SELECT COUNT(*) FROM {$CONFIG['TABLE_PICTURES']} AS p
            INNER JOIN {$CONFIG['TABLE_ALBUMS']} AS r ON r.aid = p.aid
            $RESTRICTEDWHERE
            AND approved = 'YES'
            AND ctime > UNIX_TIMESTAMP() - 60*60*24*30
            AND pid > $pid";
Title: Re: Last uploads album
Post by: paulgul on November 08, 2010, 04:41:56 PM
Thanks for that, just what I needed.
Paul