• You are here: 
  • Home
  • Lester Chan

wp-useronline hack

Posted on October 22nd, 2007 by Richard Catto 2,271 views

I use the wp-useronline plugin by Lester Chan to show who’s cruising my site at any given time. I make this information available to guests and registered users alike, because I think people like knowing that they’re not alone on here. It’s nice to be able to reach out and touch others, so to speak. :)

For administrators, the plugin is also supposed to show the IP addresses of those on the site. However it never did that for me and I dismissed it with a shrug. Then I did the new site for Candy and discovered that I could see the IP addresses of browsers there. Wtf? Why was she so damn special and me not? I was mildly miffed. So I set out to discover the reason.

And I did find the problem too! :-D

In Lester’s useronline.php file, there is a check_ip() function. On line two of that function is this statement:

$user_level = intval($current_user->wp_user_level);

Please edit this statement to read:

$user_level = intval($current_user->user_level);

Then IP addresses will display. wp_user_level is actually the name of the database field, PROVIDED, you have not chosen a custom prefix, which I had done for this site. user_level is the correct name of the variable which tells Lester’s plugin whether or not the logged in user is an administrator or not.

That’s it. Make this fix and your IP address not showing problem is fixed.

If you would like to display country flags next to each user, then install the ip2nation plugin. You also need to manually install two mySQL database tables, and populate them with Ip data for the countries. This can be done with phpMyAdmin. Here is the ip2nation sql script that does that all for you.

Tags: , , ,
Filed under Lester Chan | 1 Comment »

Switch to our mobile site

close
Afrigator