Welcome to the Question2Answer Q&A. There's also a demo if you just want to try it out.
+2 votes
435 views
in Q2A Core by

So rather than incrementing the 'view' count for a question based on how many unique people have actually viewed the question (IP based), I'd simply like it to increment every time someone views it.  So if they view it 5 times, the view counter value for that question increments by 5.  

(It would be nice to exclude bot 'views', since that could really get out of control! But only if it's within the scope of the same question, then it's my 'follow-up question' wink ! )

Q2A version: 1.7.4

2 Answers

+2 votes
by
selected by
 
Best answer
Look at the bottom of pages/question.php. There's a big if statement with various checks. You can remove the two IP checks (the ones with "different IP" comments).

qa_is_human_probably() is the one that checks bots so leave that in if you want to exclude those.
by
That, of course, works wonderfully, as I expected it to - and thank you, kindly!  But is it true that it is the ONLY possibility to hard-code it into the Q2A-Core?  IOW, should I, say, try to update to the (hopefully soon: non-beta ridiculously-stable version of 1.8x), then this change will be lost, right?  Are there any alternatives that will translate seamlessly with most upgrades?  Or is that essentially the limitations of the design up to this point?
by
That if clause there sets a value on $qa_content:

$qa_content['inc_views_postid']=$questionid;

So this would be possible to override in a few different places. For example in a theme you have access to that variable via $this-content. You should be able to set that array key somewhere in there.
–1 vote
by
I delete all the clauses and keep only the main code, but it doesn't work.

$qa_content['inc_views_postid']=$questionid;

I tried to refresh a page a dozen time but the view-count is still stick to IP somehow.
...