forum.coppermine-gallery.net

Support => cpg1.5.x Support => cpg1.5 miscellaneous => Topic started by: NewYorkIslander10 on December 12, 2015, 02:05:36 am

Title: Is there a way to change the gallery's overall views?
Post by: NewYorkIslander10 on December 12, 2015, 02:05:36 am
Where it says categories with number amount of comments then viewed a number of times is there a way to change that viewed number?


Sorry if I'm posting in the wrong place.
Title: Re: Is there a way to change the gallery's overall views?
Post by: NewYorkIslander10 on December 17, 2015, 02:14:29 am
Can anyone help me or answer?
Title: Re: Is there a way to change the gallery's overall views?
Post by: Αndré on January 08, 2016, 04:06:41 pm
How exactly should it be changed? It's simply the sum of all picture views in your gallery. Of course it could be modified, but I just wonder why you want to do this.
Title: Re: Is there a way to change the gallery's overall views?
Post by: NewYorkIslander10 on January 09, 2016, 06:04:57 pm
How can this be modified?
Title: Re: Is there a way to change the gallery's overall views?
Post by: Αndré on January 09, 2016, 10:08:21 pm
There are several ways:
1. Adjust the view counter of each picture manually in the database
2. Set (or multiply) the view counter of each picture automatically, with an appropriate database query
3. Keep the actual view counters of the pictures as they are, but manipulate the output (multiply or set a number)
Title: Re: Is there a way to change the gallery's overall views?
Post by: NewYorkIslander10 on January 13, 2016, 07:21:23 am
How do I do it where you stated I keep the view count but I manipulate the output?
Title: Re: Is there a way to change the gallery's overall views?
Post by: Αndré on January 13, 2016, 04:51:43 pm
Open index.php, find
Code: [Select]
            $sql = "SELECT SUM(hits) FROM {$CONFIG['TABLE_PICTURES']}";

            if ($pic_filter) {
                $sql .= " AS p INNER JOIN {$CONFIG['TABLE_ALBUMS']} AS a ON a.aid = p.aid WHERE approved = 'YES' $pic_filter";
            } else {
                $sql .= " WHERE approved = 'YES'";
            }

            $result = cpg_db_query($sql);
            $nbEnr = mysql_fetch_row($result);
            $hit_count = (int)$nbEnr[0];
            mysql_free_result($result);
and replace with
Code: [Select]
            $hit_count = 123456;
Title: Re: Re: Is there a way to change the gallery's overall views?
Post by: Αndré on January 13, 2016, 04:55:36 pm
2. Set (or multiply) the view counter of each picture automatically, with an appropriate database query

Solution here: http://forum.coppermine-gallery.net/index.php/topic,78552.msg380631.html#msg380631
Title: Re: Is there a way to change the gallery's overall views?
Post by: NewYorkIslander10 on January 15, 2016, 02:11:02 am
Will the gallerys overall views be stayed at this number you gave or will it add up when people visit the gallery?  --->      $hit_count = 123456;
Title: Re: Is there a way to change the gallery's overall views?
Post by: Αndré on January 15, 2016, 01:39:35 pm
It won't change with the current mod. If you want to add or multiply the actual views, undo the last mod. Instead, find
Code: [Select]
            $hit_count = (int)$nbEnr[0];and replace with
Code: [Select]
            $hit_count = (int)$nbEnr[0];
            $hit_count = $hit_count + 1234;
or
Code: [Select]
            $hit_count = (int)$nbEnr[0];
            $hit_count = $hit_count * 2;
Title: Re: Is there a way to change the gallery's overall views?
Post by: NewYorkIslander10 on January 28, 2016, 06:38:26 am
Thanks solved.