Albums Views on the main page Albums Views on the main page
 

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

Albums Views on the main page

Started by Butterfly., October 21, 2015, 08:01:37 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Butterfly.

Hello,

I noticed that this website: http://jamie-dornan.org/gallery/index.php added under the albums the views but the views are not the number times of the albums were viewed, but it's the total of the views in the inside.

Does anyone know how to do that please ?

Woudl be a life savior.

Thanks a lot

Αndré

Quote from: Αndré on February 11, 2014, 11:29:52 AM
To sum up the album and file views for the "last updated albums" meta album (lastalb), open include/functions.inc.php, find
            if ($set_caption) {
                build_caption($rowset, array('ctime'), 'albums');
            }

and above, add
            foreach ($rowset as $key => $album) {
                if ($alb_keyword = mysql_result(cpg_db_query("SELECT keyword FROM {$CONFIG['TABLE_ALBUMS']} WHERE aid = {$album['aid']} LIMIT 1"), 0)) {
                    $keyword = "OR keywords LIKE '%$alb_keyword%'";
                } else {
                    $keyword = '';
                }
                if ($file_hits = mysql_result(cpg_db_query("SELECT SUM(hits) FROM {$CONFIG['TABLE_PICTURES']} WHERE aid = {$album['aid']} AND approved = 'YES' $keyword"), 0)) {
                    $rowset[$key]['alb_hits'] += $file_hits;
                }
            }