coppermine-gallery.com/forum

Support => cpg1.5.x Support => cpg1.5 themes (visuals) => Topic started by: roaftech on February 19, 2014, 08:46:37 PM

Title: Caption below Latest Upload Thumbnails
Post by: roaftech on February 19, 2014, 08:46:37 PM
I want to change the default caption below the 'Latest Uploads' thumbnails, to remove the upload date and replace it with the photo taken date and time which I record as the 'user2' optional variable.
I have found a partial answer at
http://forum.coppermine-gallery.net/index.php/topic,74575.msg359032.html
13/Mar/2012
snip ...
Open include/functions.inc.php, find
Code: [Select]
        if ($set_caption) {
            build_caption($rowset, array('ctime'));
        }
        $rowset = CPGPluginAPI::filter('thumb_caption_lastup', $rowset);
and replace with
Code: [Select]
        if ($set_caption) {
            build_caption($rowset);
        }
        $rowset = CPGPluginAPI::filter('thumb_caption_lastup', $rowset);

...snip
which removes the upload date satisfactorily.

I have attempted to substitute 'user2' in place of 'ctime' but nothing appears in the captions.  I have had a look into the sql database tables and confirmed that the field exists, is correctly named and does contain data.  If I use 'mtime' instead I get a date in 1970 (presumably the date zero in the operating system?) and so I conclude that the problem is in the way the 'ctime' is decoded. 
Any advice?
Title: Re: Caption below Latest Upload Thumbnails
Post by: ΑndrĂ© on February 28, 2014, 12:27:44 PM
Please have a closer look at the function build_caption in include/functions.inc.php.

It contains several lines to know how to deal with submitted parameters, e.g.
        if (in_array('ctime', $must_have)) {
            $caption .= '<span class="thumb_caption thumb_caption_ctime">' . localised_date($row['ctime'], $lang_date['lastup']) . '</span>';
        }

so you need to add an additional block like
        if (in_array('user2', $must_have)) {
            $caption .= '<span class="thumb_caption thumb_caption_user2">' . $row['user2'] . '</span>';
        }
Title: Re: Caption below Latest Upload Thumbnails
Post by: roaftech on February 28, 2014, 07:05:42 PM
Thanks Andre, that resolves it.