Display Number of Album Views & Total Number of Image Views in Album Display Number of Album Views & Total Number of Image Views in Album
 

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

Display Number of Album Views & Total Number of Image Views in Album

Started by Rainakthx, May 30, 2013, 05:56:59 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Rainakthx

Hi,

I have seen this on a few other galleries and was wondering if someone could tell me how to do it?

In a gallery, where it display the number of album views under the album - I would like it to total all the image views in that album and display it underneath as well.

Can anyone help?

Thanks in advance!

- Raina

ΑndrĂ©

Open index.php, find
$sql = "SELECT a.aid, count( p.pid ) AS pic_count, max( p.pid ) AS last_pid, max( p.ctime ) AS last_upload, a.keyword, a.alb_hits"
and replace both matches with
$sql = "SELECT a.aid, count( p.pid ) AS pic_count, max( p.pid ) AS last_pid, max( p.ctime ) AS last_upload, a.keyword, a.alb_hits, sum( p.hits) AS file_hits"

find
$alb_list[$alb_idx]['alb_hits'] = sprintf($lang_list_albums['alb_hits'], $alb_hits);
and replace both matches with
$alb_list[$alb_idx]['alb_hits'] = sprintf($lang_list_albums['alb_hits'], $alb_hits).' / '.($alb_stat['file_hits'] ? $alb_stat['file_hits'] : 0).' file views';

find
            $alb_list[$aid]['alb_hits'] = sprintf($lang_list_albums['alb_hits'], $album['alb_hits']);
and replace both matches with
            $file_hits = mysql_result(cpg_db_query("SELECT SUM(hits) FROM {$CONFIG['TABLE_PICTURES']} WHERE aid = $aid AND approved = 'YES'"), 0);
            $alb_list[$aid]['alb_hits'] = sprintf($lang_list_albums['alb_hits'], $album['alb_hits']).' / '.($file_hits ? $file_hits : 0).' file views';