Home

Hello. My name is Noemi Millman, and Triopter is my web development agency. We handcraft beautiful, dynamic websites.

See what I can do for you.

Noemi Millman: Triopter: Fixing up WP-SlimStat

Fixing up WP-SlimStat

One of my favorite WordPress plugins is WP-SlimStat, which allows you to track blog traffic in real time, and even if you don’t have access to raw log files and a log analysis software package.

Now, although SlimStat installed and ran without a hiccup on a couple of other blogs I administer, when I tried to add it to Triopter, it completely borked my blog, aborting the rendering of any page after the first post heading and before the content. The SlimStat dashboard panel was also coming up empty.

A few other people on the author’s blog had reported this problem, but without anyone offering a solution, so I decided to look into it on my own. Here are my quick-and-dirty fixes.

Fixing blank posts

The first problem, the blank posts, was occurring because SlimStat had added a content filter function, but for reasons I can’t fathom, when WordPress called the function, it was never entered. The filter implements an optional feature anyway, replacing a specially-formatted HTML comment with a recent referrers list within the blog.

If you don’t use that function, just comment out the line that applies the filter. At the bottom of the plugins/wp-slimstat/wp-slimstat.php file (line 3606), change

add_filter('the_content', 'slimstatTagReferers');

to

//add_filter('the_content', 'slimstatTagReferers');

Fixing blank stats

The blank stats page turned out to occur because SlimStat relies on localization to output all of its results, but the code that WordPress needs in order to process this is included only if you’ve defined your locale (which most people don’t, and which requires adding a language pack).

To make the stats show up properly, find wp-includes/wp-l10n.php. Change line 3 from

if ( defined('WPLANG') && '' != constant('WPLANG') ) {

to

if ( defined('WPLANG')) {

And there you go – SlimStat should work, without breaking anything else on the blog.
I have to say, I have no clue why these problems don’t break SlimStat on the other blogs I run. Presumably it’s some sort of PHP or Apache configuration issue. In any case, I’ve now got it working everywhere, and I hope this helps someone else!

Post a Comment

Your email is never published nor shared. Required fields are marked *

Comments may be held for moderation to prevent spam: your comment may not appear immediately.