Kunena 6.3.0 released

The Kunena team has announce the arrival of Kunena 6.3.0 [K 6.3.0] in stable which is now available for download as a native Joomla extension for J! 4.4.x/5.0.x/5.1.x. This version addresses most of the issues that were discovered in K 6.2 and issues discovered during the last development stages of K 6.3

Solved Prevent counting of article views two times for non-logged in users

More
7 years 11 months ago #1 by joshub5
Hi,
Am quite new to joomla and kunena B)
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.
Regards

Please Log in or Create an account to join the conversation.

More
7 years 11 months ago #2 by sozzled
I don't think it's possible (certainly not with "out of the box" Kunena) and I don't think I've ever seen anyone suggest how it could be done, either.

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.

Please Log in or Create an account to join the conversation.

More
7 years 11 months ago #3 by joshub5
Hi,
DO you know the file to edit? searching and looks like cant get it B)

Please Log in or Create an account to join the conversation.

More
7 years 11 months ago #4 by sozzled
That's a good question. Again, I would be guessing, but we're basically trying to find where the _kunena_topics table (hits column) is incremented whenever a user views the topic on the forum. So, we're basically trying to locate a line of code that says something like "->hits++;".

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?

Please Log in or Create an account to join the conversation.

More
7 years 10 months ago #5 by joshub5
Hi,
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?

Please Log in or Create an account to join the conversation.

Time to create page: 0.479 seconds