Wordpress -

One of the things I wanted from visitor counters was ability to do this in real time (without page reload). Some time ago I found Rtoc (real time online counter) using Ajax technology. Developer writes - ” RTOC is a free statistics script that uses flatfiles to store data. It includes an online users counter as well as a unique hits counter that stores unique hits for that day as well as a total. It uses JavaScript to update itself dynamically, so that all stats are in real-time! It has been tested and working on both Firefox 1.5 and Internet Explorer 6 web browsers.”

I installed it with my multi room shoutbox page (you can find a link to it on bottom of my sidebar). Rtoc is really easy to install for webmasters. Just make sure that you CHMOD two text files for storing data to 777.

Using flat files for storing data may cause some data loss (resetting totals) in case of large traffic flow. My site is not experiencing Large traffic flow so I did not notice any strange behaviour. Actually I don’t care about totals. I wanted users online in real time and I got it - this part of script seems to work flawlessly.

Developer plans to make MySQL version of this script so that it will handle large traffic flows easily.

Meanwhile I coded WP plugin out of this script - UsersOnline Plugin

Installation:

- unzip
- put “UsersOnline” folder with all its content into “Plugins” folder of WP installation
- CHMOD online.txt and stats.txt to 777 (Important!!!)
- Activate plugin
- Put this code in sidebar or page (where you want stats to show)

<?php if(function_exists('users_online')){users_online();}; ?>


Through admin page (under “plugins”) you can set text for fields and choose what to show and what not to show. Default values for texts are: Users online, Uniques today, Uniques Total. Tested and works on WP2.02 installation. I do not guarantee its work with older WP versions.

That’s all. Feel free to ask me through comments.

41 Responses to “Real Time Users Online Counter Plugin”

  1. Palmdoc  

    After activating the plugin, I get this error:

    Fatal error: Cannot redeclare add_page() (previously declared in [webdir]\httpdocs\wp\wp-content\plugins\usersonline\usersonline.php:15) in
    [webdir]\httpdocs\wp\wp-content\plugins\usersonline\usersonline.php on line 14

  2. 1 Tash  

    I found possible cause of this error - function naming conflict.

    I fixed this and updated package.

  3. 2 Palmdoc  

    Thanks for trying. But now I get this error:
    Fatal error: Cannot redeclare adrtoc_page() (previously declared in [webdir]\httpdocs\wp\wp-content\plugins\usersonline\usersonline.php:15) in
    [webdir]\httpdocs\wp\wp-content\plugins\usersonline\usersonline.php on line 14

  4. 3 Tash  

    The only option left is to check wp database for duplicate entry for that plugin in the field for active_plugins in the wp_options table.

    Go wp_options table in wp database. Locate field active_plugins. Make sure that you have only one record for that plugin there.

    UPDATE: Just looked at your page source and found that you run WP1.5. If so, then be aware (as i mentioned in the post for that plugin) its tested with wp2.0 and i do not guarantee its work on earlier wp versions.

  5. 4 Palmdoc  

    Strange. I don\’t see the field active_plugins in wp_options table. I see option_id, blogid and 9 other fields but no active_plugins… even with the plugin activated

  6. 5 Tash  

    Just looked at your page source and found that you run WP1.5. If so, then be aware (as i mentioned in the post for that plugin) its tested with wp2.0 and i do not guarantee its work on earlier wp versions.

  7. 6 Palmdoc  

    Hangon, found it with a search but I have no idea what it means. Here’s a CSV export

    “45″,”0″,”active_plugins”,”Y”,”1″,”a:20:{i:0;s:0:”"”";i:1;s:11:”"adsense.php”";i:2;s:39:”"bad-behavior/bad-behavior-wordpress.php”";i:3;s:23:”"get-recent-comments.php”";i:4;s:12:”"gravatar.php”";i:5;s:16:”"most_popular.php”";i:6;s:13:”"padd_poll.php”";i:7;s:12:”"pageview.php”";i:8;s:9:”"polls.php”";i:9;s:10:”"runphp.php”";i:10;s:16:”"search_pages.php”";i:11;s:11:”"sitemap.php”";i:12;s:23:”"spam_karma_2_plugin.php”";i:13;s:15:”"spell-check.php”";i:14;s:12:”"stattraq.php”";i:15;s:9:”"witty.php”";i:16;s:11:”"wp-cron.php”";i:17;s:16:”"wp-db-backup.php”";i:18;s:20:”"wp-mobile.plugin.php”";i:19;s:29:”"wp-phpmailer/wp-phpmailer.php”";}”,”20″,”8″,,”1″,”yes”

  8. 7 Tash  

    Palmdoc,

    What WP version you are running on your site?

  9. 8 Palmdoc  

    OK I understand. But thanks for your help anyway.

  10. 9 Palmdoc  

    Tash, I am running 1.5.1.3

  11. 10 Tash  

    I would suggest you upgrading to WP2.0.2. But this can be painful, if you have many plugins installed and some of them may require upgrading as well. Though its better to do it now, because if you wait more, upgrading may become even more problematic with newer WP versions.

    Or you can install RTOC (if you are experienced in php installations then its very simple), original usersonline script from http://www.j-fx.ws/rtoc/.

  12. 11 Lola  

    I love this plugin! I just wonder how I go from vertical to horizontal, can it be done? How?

  13. 12 Tash  

    You can change output at the end of rtoc.php file, if you have some coding experience

  14. 13 Vilyamjw  
  15. 14 Vilyamjw  
  16. 15 Vilyamio  
  17. 16 klira  
  18. 17 klira  
  19. 18 Vilyamrj  

    dob

  20. 19 klira  
  21. 20 Vilyamay  
  22. 21 klira  
  23. 22 klira  
  24. 23 Vilyamkx  
  25. 24 klira  
  26. 25 Vilyamgl  
  27. 26 klira  
  28. 27 Vilyamcj  
  29. 28 klira  
  30. 29 Vilyampe  
  31. 30 klira  
  32. 31 klira  
  33. 32 Vilyamuv  
  34. 33 klira  
  35. 34 klira  
  36. 35 Vilyamty  
  37. 36 klira  
  38. 37 Vilyameo  
  39. 38 Vilyammc  
  40. 39 klira  
  41. 40 klira  

Leave a Comment

This is a captcha-picture. It is used to prevent mass-access by robots. (see: www.captcha.net)

You must read and type the 5 chars within 0..9 and A..F, and submit the form.

  

Oh no, I cannot read this. Please, generate a