Last uploads always shows all Last uploads always shows all
 

News:

cpg1.5.48 Security release - upgrade mandatory!
The Coppermine development team is releasing a security update for Coppermine in order to counter a recently discovered vulnerability. It is important that all users who run version cpg1.5.46 or older update to this latest version as soon as possible.
[more]

Main Menu

Last uploads always shows all

Started by ralfs, February 06, 2006, 12:01:53 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

ralfs

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

Abbas Ali

Chief Geek at Ranium Systems

ralfs

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

Abbas Ali

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
Chief Geek at Ranium Systems

ralfs

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

Abbas Ali

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
Chief Geek at Ranium Systems

ralfs

Changed to 14 days, up and running - great!

Thank you very much, this is real support.

Ralf

lordprodigy

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.

Joachim Müller


lordprodigy