Album hit counts Album hit counts
 

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

Album hit counts

Started by bgrella, May 31, 2012, 11:37:30 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

bgrella

Hi

I'm using coppermine 1.5.20 (stable)

My site: http://www.garagewoodworks.com/Forum/forum_projects.php

The above gallery links users to http://www.garagewoodworks.com/copper/displayimage.php?album=27&pid=100#top_display_media for a project.

The hit counter isn't incrementing for a visit to the above link.  Is there any easy solution for this?  Can I add +1 to the table for the photo and +1 to the album table?

Please help.

Cheers,
Brian

bgrella

If I increment the table for the photo and album how is it best to treat multiple hits by the same user to the same album?

Αndré

A hit to an album is only added if the user views the thumbnail page, i.e. http://www.garagewoodworks.com/copper/thumbnails.php?album=27 - so you should link it to that page IMHO.

bgrella

Is it possible to increment the table 'albums' for that user after the user lands on the page '/displayimage.php?album=**'  by adding code to the displayimage.php page?

Αndré

Copy the function theme_display_image from themes/sample/theme.php to your theme's theme.php file if it doesn't exist. Then, find
$superCage = Inspekt::makeSuperCage();
and below, add
    global $USER;
    $album = mysql_result(cpg_db_query("SELECT aid FROM {$CONFIG['TABLE_PICTURES']} WHERE pid = ".$superCage->get->getInt('pid')), 0);
    if (is_numeric($album)) {

        // Create an array to hold the album id for hits (if not created)
        if (!isset($USER['liv_a']) || !is_array($USER['liv_a'])) {
            $USER['liv_a'] = array();
        }

        // Add 1 to album hit counter
        if ((!USER_IS_ADMIN && $CONFIG['count_admin_hits'] == 0 || $CONFIG['count_admin_hits'] == 1) && !in_array($album, $USER['liv_a']) && $superCage->cookie->keyExists($CONFIG['cookie_name'] . '_data')) {

            add_album_hit($album);

            if (count($USER['liv_a']) > 4) {
                array_shift($USER['liv_a']);
            }

            array_push($USER['liv_a'], $album);
            user_save_profile();
        }
    }

bgrella