Album hit counts Album hit counts
 

News:

CPG Release 1.6.26
Correct PHP8.2 issues with user and language managers.
Additional fixes for PHP 8.2
Correct PHP8 error with SMF 2.0 bridge.
Correct IPTC supplimental category parsing.
Download and info HERE

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