Tag Archives: bugs

Got problems with Internet Explorer 7 and StatTraq? Here’s a solution.

*UPDATE: As of December 1st, when version 1.1 is released, this issue is fixed.

I’ve just installed StatTraq, a popular WordPress plugin for tracking your site’s statistics. I like it and I can’t wait to see the first ‘real’ results after a month or so has passed.

But the problem is – Internet Explorer 7 just won’t load the page if you’ve got StatTraq running. I was getting a blank page and a “Internet Explorer cannot open this page” error. No code errors, no warnings, nothing, as if the site is unavailable.

So I searched around a bit and found this post by Avery J. Parker with a small clue in it :) Avery wrote:

…carried this error at the bottom of the page (ONLY in IE7 by the way…) “Fatal error: Call to undefined function:() in /var/www/html/radiotv/wp-content/plugins/stattraq.php on line 90”

Around line 90, there’s a function for browser detection and Internet Explorer 7 wasn’t on the list. I guess IE7 didn’t like that very much, heh. Anyways, all you need to do to fix the problem is:

  1. Open ‘stattraq.php’ file that resides in your ‘wp-content/plugins’ folder
  2. Go to line 80/81 and replace:
    if(strpos($ua, 'MSIE 6')!==false || -->
    strpos($ua, 'MSIE6')!==false)
    $ver = 6;

    with:

    if(strpos($ua, 'MSIE 7')!==false || -->
    strpos($ua, 'MSIE7')!==false)
    $ver = 7;
    else if(strpos($ua, 'MSIE 6')!==false || -->
    strpos($ua, 'MSIE6')!==false)
    $ver = 6;

    *note: –> means that this is not the end of the line, line breaks at ‘$ver = …’

  3. Save the file and you’re done.
  4. Check the page in Internet Explorer 7 and be happy if everything works :)

It worked for me, but if it doesn’t do the trick for you, please leave a comment.

I’ve posted a comment on StatTraq’s page so this will hopefully be fixed in the next version.

Just a quick tip regarding Internet Explorer 6, CSS and underscores

If you ever find yourself in a situation where you have to go through your stylesheet and disable/enable selector properties one by one just to figure out which one is IE6 having a fight with, please don’t be stupid like me and don’t do it by adding an underscore (_) at the beginning of selector’s name (for example: “_clear: right;”) — to IE6 it’s all the same, “_clear” equals “clear”. Rather comment it out or delete a letter.

I don’t know if it applies to all selector properties, I don’t have the will to google for it right now, I’m too tired.