#1 2018-12-09 14:01:39

MetallicAchu
Member
2018-12-09
2

Reset number of Visits / Hits for pictures

Hello everyone,

I tried searching the forums, also Google, but couldn't find a way to reset hits / visits for the entire gallery.
I did manage to reset history for pages seen, but not on the pictures themselves.

Any assistance would be very appreciated.

Piwigo version: 2.9.4
PHP version: 5.6.30
MySQL version: 5.6.41-84.1
Piwigo URL: http://adars.co.il (NSFW)

Offline

 

#2 2018-12-10 01:52:16

erAck
Only trying to help
2015-09-06
2236

Re: Reset number of Visits / Hits for pictures

Enter hit in Plugins -> Manage -> Other plugins available, [extension by ddtddt] Delete Hit/Rate


Running Piwigo at https://erack.net/gallery/

Offline

 

#3 2018-12-10 07:04:41

MetallicAchu
Member
2018-12-09
2

Re: Reset number of Visits / Hits for pictures

Worked like a charm, thank you very much

Offline

 

#4 2025-12-03 19:35:35

neon
Member
2023-03-27
54

Re: Reset number of Visits / Hits for pictures

Installed this plugin, and came to the same question ;)
Found how to delete hits/rates for a single photo, and for an album (but without sub-albums)
BUT can not find how to delete hits/rates for the whole gallery! Nothing changes at Tools > Maintenance page wherever I activate/deactivate this plugin...

Piwigo 15.6
Theme Modus
Tried to disable all other plugins - no effect.

Is there some hidden way to call these functions? Maybe an SQL command? Should be easy - but not at my level of knowledge :(

Offline

 

#5 2025-12-03 20:50:12

moberley
Member
2025-11-10
90

Re: Reset number of Visits / Hits for pictures

The buttons for clearing the whole gallery should be on the Tools > Maintenance page but there seems to be a compatibility issue with newer versions of Piwigo in the way that those options are displayed so you may not see them on that page.

If you do not see the buttons after clicking the "Purge compiled templates" button to regenerate the page then you can add the following to the LocalFiles Editor personal plugin to make the buttons appear. (You would need to make sure the personal plugin and Delete Hit/Rate plugins are both active and click the "Purge compiled templates" button one time after modifying the personal plugin.)

This worked for me on version 16.1.0 to show the buttons and allow them to function. I think it should also work on 15.x versions but I can't test that.

Code:

add_event_handler('loc_begin_admin_page', 'personal_dphr_prefilter');
function personal_dphr_prefilter()
{
  global $template;
  $template->set_prefilter('maintenance', 'personal_dphr_insertbtns');
}

function personal_dphr_insertbtns($content){
  $search = '<a href="{$U_MAINT_SEARCH}" class="{$maint_actions[\'search\'][\'icon\']} maintenance-action purge-search-history-button">{$maint_actions[\'search\'][\'label\']}</a>';
  
  $replacement = '<a href="{$U_DELETEHIT}" class="icon-trash mouse maintenance-action purge-search-hits">{\'Purge all hits on all pictures gallery\'|@translate}</a>
  <a href="{$U_DELETERATE}" class="icon-trash-1 maintenance-action purge-search-rates">{\'Purge all rate on all pictures gallery\'|@translate}</a>';

  return str_replace($search, $search.$replacement, $content);
}

Last edited by moberley (2025-12-03 20:55:08)

Offline

 

#6 2025-12-03 23:29:41

neon
Member
2023-03-27
54

Re: Reset number of Visits / Hits for pictures

Thanks a lot, moberley!

Your code for personal plugin worked perfectly!

Offline

 

Board footer

Powered by FluxBB