Is it possible to set up the hitcounter function so that the views number increases when any user (except the admin) views an image?
I have admin rights so when I click on an image the hits number stays the same, I logged in with an account with user rights thinking the hits number would increase but it doesn't, it's as if I'm the admin.
Comments
`if (!isMyALbum($_zp_current_album->name, LIST_ALBUM_RIGHTS))`
The syntax varies depending on whether it is checking rights to a page, news item, album, or image. You can modify these checks to not care if the object in question belongs to the current user.
I'm guessing the logic behind this was that the counter should show how many "visitors" viewed an object, without counting hits by the owner who may simply be verifying that the object looks correct on the page. Seeing that an image was hit 5,000 times isn't all that helpful if you don't also take into account that 4,500 of those hits was from the person looking at it themself :-)
I have modified my hitcounter.php to exclude hits from the same IP address as the server. I run my own server on the development machine, and I often verify that changes to the site work correctly for both logged-in users and visitors, but I don't want my own hits counting there either.
I added a patch, which should work, and at least doesn't seem to crash! I have to double-check the modified logic for ignoring object owners if configured to do so, and determine how effective the current method of detecting bots/crawlers is. Feedback welcome.
Just one question as I'm not familiar with this patch thing, could you explain how this would be implemented if I wanted to use it now?
I suppose I have to replace the old hitcounter.php with the updated patch. Do I also need to change something else around or just that it's enough?
However, I would advise not to use the existing patch as it is likely to cause your site to become slower as it is implemented now.
Barbara, the free Windows utility WinMerge is a good choice. Once I have made some changes to the patch as suggested, I can also attach both the patch and a full copy of the file for you. How much slower the existing implementation would make your site depends on a few things, including how many hits it normally gets. Those small inefficiencies, multiplied by millions of hits, definitely add up!