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: Is there a way to change the gallery's overall views?  (Read 5783 times)

0 Members and 1 Guest are viewing this topic.

NewYorkIslander10

  • Coppermine novice
  • *
  • Offline Offline
  • Posts: 28
Is there a way to change the gallery's overall views?
« 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.
Logged

NewYorkIslander10

  • Coppermine novice
  • *
  • Offline Offline
  • Posts: 28
Re: Is there a way to change the gallery's overall views?
« Reply #1 on: December 17, 2015, 02:14:29 am »

Can anyone help me or answer?
Logged

Αndré

  • Administrator
  • Coppermine addict
  • *****
  • Country: de
  • Offline Offline
  • Gender: Male
  • Posts: 15764
Re: Is there a way to change the gallery's overall views?
« Reply #2 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.
Logged

NewYorkIslander10

  • Coppermine novice
  • *
  • Offline Offline
  • Posts: 28
Re: Is there a way to change the gallery's overall views?
« Reply #3 on: January 09, 2016, 06:04:57 pm »

How can this be modified?
Logged

Αndré

  • Administrator
  • Coppermine addict
  • *****
  • Country: de
  • Offline Offline
  • Gender: Male
  • Posts: 15764
Re: Is there a way to change the gallery's overall views?
« Reply #4 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)
Logged

NewYorkIslander10

  • Coppermine novice
  • *
  • Offline Offline
  • Posts: 28
Re: Is there a way to change the gallery's overall views?
« Reply #5 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?
Logged

Αndré

  • Administrator
  • Coppermine addict
  • *****
  • Country: de
  • Offline Offline
  • Gender: Male
  • Posts: 15764
Re: Is there a way to change the gallery's overall views?
« Reply #6 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;
Logged

Αndré

  • Administrator
  • Coppermine addict
  • *****
  • Country: de
  • Offline Offline
  • Gender: Male
  • Posts: 15764
Re: Re: Is there a way to change the gallery's overall views?
« Reply #7 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
Logged

NewYorkIslander10

  • Coppermine novice
  • *
  • Offline Offline
  • Posts: 28
Re: Is there a way to change the gallery's overall views?
« Reply #8 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;
Logged

Αndré

  • Administrator
  • Coppermine addict
  • *****
  • Country: de
  • Offline Offline
  • Gender: Male
  • Posts: 15764
Re: Is there a way to change the gallery's overall views?
« Reply #9 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;
Logged

NewYorkIslander10

  • Coppermine novice
  • *
  • Offline Offline
  • Posts: 28
Re: Is there a way to change the gallery's overall views?
« Reply #10 on: January 28, 2016, 06:38:26 am »

Thanks solved.
Logged
Pages: [1]   Go Up
 

Page created in 0.02 seconds with 20 queries.