- Posts: 3
- Thank you received: 0
The Kunena team has announce the arrival of Kunena 6.2.4 [K 6.2.4] which is now available for download as a native Joomla extension for J! 4.3.x/4.4.x/5.0.x. This version addresses most of the issues that were discovered in K 6.1 / K 6.2 and issues discovered during the last development stages of K 6.2
Solved Prevent counting of article views two times for non-logged in users
Am quite new to joomla and kunena
Am having a problem where by if the user is not logged in before viewing an article,the number of views keep increasing each time the same user visits the link.
How can I prevent this for non-logged in users?
For logged in users it works out of the box and counts only one view even if the same users visits the article a number of times.
My guess is that you would have to hack the source files to achieve this particular result. Shouldn't be too difficult if you know your way around PHP programming and know which files to modify. Probably a couple of hours for an experienced programmer.
Using a tool like Windows Grep , for example, you can search files to locate strings of text. That's what I would be doing.
I am making an educated guess—the Kunena developers can confirm if I'm right—but it looks like the number of hits (i.e. topic views) is incremented in the file ../libraries/kunena/forum/topic/topic.php.
What you would have to do is to insert an if-test to check if the topic was being viewed by someone who is already logged-in and, accordingly, execute the part the increments the counter. Does that help?
I was able to achieve the same and the file to edit is ../libraries/kunena/forum/topic/topic.php.
I stored cookies on user's browsers.
At least it is a good approximation for the number of hits but not so exact as users don't always use the same browser.
Now I want to prevent views from adding for logged in users.
I know it is achievable and am guessing one can store user information in topics table so when the users hits the topic again the hits are not incremented.At least for logged in users we can prevent this across browsers
Do you know the best way to do this?