Welcome to the Question2Answer Q&A. There's also a demo if you just want to try it out.
+1 vote
841 views
in Q2A Core by
Hi there

How do i change view count based IP to view count per view ?

thank you very much

2 Answers

+2 votes
by

If I understand correctly, you want to count two consecutive views from the same IP address as two separate views?

If so, look at the bottom of qa-page-question.php and remove the full line which contains the word 'lastviewip'.

I don't think this is a good idea though, since one person can really easily artificially bump up the view count, by refreshing the page.

by
i i want to count the post views based on user ip address ..which plugin are u using
+2 votes
by

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!

gidgreen: I don't think this is a good idea though, since one person can really easily artificially bump up the view count, by refreshing the page

--> He was right! :)

...