PostViews Bug?
  • A user had reported a possible bug in PostViews. Apparently it counts page requests, not sessions. This means when a user makes a comment, it is counted as three views at least: when s/he actually reads the entry, when the page with the comment form is reloaded, and when the page is displayed with the comment again. If a page is reloaded via F5 or due to a captcha error, it is counted as additional reads.
    The user suggests using session handling to count entry views better. I know nothing about session handling, so I had to forward the request to you.
  • it's not a bug, that's how it works. I didn't want to bother with writing a better plugin. It is even disabled by default, and it is mostly useless (if you want good stats, I recommend installing google analytics or similar software)... if anybody here is willing to take a spin with writing a better view counter, feel free ;)
  • However it's quite easy to bypass.
    Flatpress uses its own functions to interface with sessions.
    sess_add($key, $val) to save and sess_get($key) to get a value.
    You could save for example the boolean true when you add the visit for the user and before adding you check with sess_get you check if you have already added for the user.

    For example
    if($calc && !user_loggedin() && !sess_get('postviews_'.$id)) {
            sess_add('postviews_'.$id, true);
            $v++;
            io_write_file($f, $v);
    }