Advanced search  

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]

Pages: [1]   Go Down

Author Topic: Albums Views on the main page  (Read 1911 times)

0 Members and 1 Guest are viewing this topic.

Butterfly.

  • Coppermine novice
  • *
  • Offline Offline
  • Gender: Female
  • Posts: 35
    • Twilight Central
Albums Views on the main page
« on: October 21, 2015, 08:01:37 pm »

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
Logged

Αndré

  • Administrator
  • Coppermine addict
  • *****
  • Country: de
  • Offline Offline
  • Gender: Male
  • Posts: 15765
Re: Albums Views on the main page
« Reply #1 on: October 22, 2015, 10:40:39 am »

To sum up the album and file views for the "last updated albums" meta album (lastalb), open include/functions.inc.php, find
Code: [Select]
            if ($set_caption) {
                build_caption($rowset, array('ctime'), 'albums');
            }
and above, add
Code: [Select]
            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;
                }
            }
Logged
Pages: [1]   Go Up
 

Page created in 0.054 seconds with 19 queries.