coppermine-gallery.com/forum

Support => cpg1.4.x Support => Older/other versions => cpg1.4 miscellaneous => Topic started by: ralfs on February 06, 2006, 12:01:53 PM

Title: Last uploads always shows all
Post by: ralfs on February 06, 2006, 12:01:53 PM
Hi,

If I click on 'Last uploads' I get all my 5000 pictures in the result album.
I expected a time range of some days or weeks. Probably configurable by the admin.
This works with my 1.42 as well as the 1.43 online demo.

Bug or feature? I haven't found that issue in the forum so far.

Best regards,
Ralf
Title: Re: Last uploads always shows all
Post by: Abbas Ali on February 06, 2006, 12:06:24 PM
Feature definitely ;)
Title: Re: Last uploads always shows all
Post by: ralfs on February 06, 2006, 12:25:31 PM
Hmmm. Wouldn't it make sense to set up a number of max days for that result? All pictures is not really the answer to 'last uploaded pictures' ...

Regards,
Ralf
Title: Re: Last uploads always shows all
Post by: Abbas Ali on February 06, 2006, 12:43:20 PM
Last Uploaded is meant to show all the photos in descending order of upload date. In your case if you want to limit them then i think you can do so by modifying the code.


Abbas
Title: Re: Last uploads always shows all
Post by: ralfs on February 06, 2006, 01:03:46 PM
Ok, thank you very much for your fast response.
I'm not able to write PHP, so probably somebody else find that interesting enough. Or feature list for NG ..

Regards,
Ralf
Title: Re: Last uploads always shows all
Post by: Abbas Ali on February 06, 2006, 01:32:19 PM
Ok a quik mod.

Edit include/functions.inc.php

Replace


        case 'lastup': // Last uploads
                if ($META_ALBUM_SET && $CURRENT_CAT_NAME) {
                        $album_name = $lang_meta_album_names['lastup'].' - '. $CURRENT_CAT_NAME;
                } else {
                        $album_name = $lang_meta_album_names['lastup'];
                }

                $query = "SELECT COUNT(*) from {$CONFIG['TABLE_PICTURES']} WHERE approved = 'YES' $META_ALBUM_SET";
                $result = cpg_db_query($query);
                $nbEnr = mysql_fetch_array($result);
                $count = $nbEnr[0];
                mysql_free_result($result);


                //if($select_columns != '*' ) $select_columns .= ',title, caption, owner_id, owner_name, aid';
                $select_columns = '*'; //allows building any data into any thumbnail caption
                $query = "SELECT $select_columns FROM {$CONFIG['TABLE_PICTURES']} WHERE approved = 'YES' $META_ALBUM_SET ORDER BY pid DESC $limit";
                $result = cpg_db_query($query);


with


        case 'lastup': // Last uploads
                if ($META_ALBUM_SET && $CURRENT_CAT_NAME) {
                        $album_name = $lang_meta_album_names['lastup'].' - '. $CURRENT_CAT_NAME;
                } else {
                        $album_name = $lang_meta_album_names['lastup'];
                }
                $days = 5; // Change this to whatever you want
                $range = time() - ($days*24*60*60);
                $query = "SELECT COUNT(*) from {$CONFIG['TABLE_PICTURES']} WHERE approved = 'YES' AND ctime > '$range' $META_ALBUM_SET";
                $result = cpg_db_query($query);
                $nbEnr = mysql_fetch_array($result);
                $count = $nbEnr[0];
                mysql_free_result($result);


                //if($select_columns != '*' ) $select_columns .= ',title, caption, owner_id, owner_name, aid';
                $select_columns = '*'; //allows building any data into any thumbnail caption
                $query = "SELECT $select_columns FROM {$CONFIG['TABLE_PICTURES']} WHERE approved = 'YES' AND ctime > '$range' $META_ALBUM_SET ORDER BY pid DESC $limit";
                $result = cpg_db_query($query);


In above code change the value of $days to whatever suit you. Photos of last x days will be displayed in Last Uploads where x is the value of $days.


HTH
Abbas
Title: Re: Last uploads always shows all
Post by: ralfs on February 06, 2006, 02:36:41 PM
Changed to 14 days, up and running - great!

Thank you very much, this is real support.

Ralf
Title: Re: Last uploads always shows all
Post by: lordprodigy on February 06, 2006, 08:00:52 PM
Abbas, this is great. I have always wanted to make this configurable. One more thing. I would like the Last uploads to list ALBUMS and not the individual pictures. Is that possible? thanks.
Title: Re: Last uploads always shows all
Post by: Joachim Müller on February 06, 2006, 09:19:58 PM
lastalb meta album?
Title: Re: Last uploads always shows all
Post by: lordprodigy on February 06, 2006, 10:17:49 PM
thats true.  :-[