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

 

Hello,
 
I would like to know how to change a setting for the question view's counter.
 
Actually, he is counting peoples from their ip. So if they come two time, it only show 1 view.
 
How to change for, when a person come on the question, it count a view, and if the same ip comeback, it count for another view ?
 
Thanks a lot
Q2A version: 1.5

1 Answer

+4 votes
by
selected by
 
Best answer

In qa-page-question.php file. Find to this lines code(end of file):

Change from:

( ($question['lastviewip']!=qa_remote_ip_address()) || (!isset($question['lastviewip'])) ) && // then it must be different IP from last view
            ( ($question['createip']!=qa_remote_ip_address()) || (!isset($question['createip'])) ) && // and different IP from the creator
            ( ($question['userid']!=$userid) || (!isset($question['userid'])) ) && // and different user from the creator
            ( ($question['cookieid']!=$cookieid) || (!isset($question['cookieid'])) ) // and different cookieid from the creator
        ) )

To:

( ($question['lastviewip']=qa_remote_ip_address()) || (!isset($question['lastviewip'])) ) && // then it must be different IP from last view
            ( ($question['createip']=qa_remote_ip_address()) || (!isset($question['createip'])) ) && // and different IP from the creator
            ( ($question['userid']=$userid) || (!isset($question['userid'])) ) && // and different user from the creator
            ( ($question['cookieid']=$cookieid) || (!isset($question['cookieid'])) ) // and different cookieid from the creator
        ) )

Done!

by
A big thank you for your help! thank you
by
You are welcome! :)
by
Pls tell me is this valid for newest version of q2a 1.6.3
by
i test for 1.6.3 and work fine, thanks sir :)
...