plainblack.com
Username Password
search
Bookmark and Share

Updated UsersOnline Macro for WebGUI 7.5

This is an update of the UsersOnline Macro initially written by Carlos Rivero. In fact, it is rather a rewrite including the following changes/enhancements:

  • Template support
  • More data being available that can be viewed (real name, username, alias, session, uid, etc.)
  • Internationalization
  • Respects Privacy
  • More documentation including a WebGUI help module
  • Testing function


The archive attached includes the following files:

WebGUI/lib/WebGUI/Macro/UsersOnline.pm - The macro itself. Do not forget to make an entry in your WebGUI configurationfile!

WebGUI/lib/WebGUI/i18n/English/Macro_UsersOnline.pm - English translation.

WebGUI/lib/WebGUI/i18n/German/Macro_UsersOnline.pm - German translation.

WebGUI/lib/WebGUI/Help/Macro_UsersOnline.pm - Help module.

WebGUI/t/Macro/UsersOnline.t - Testing function, which can be used to check the macro. You need to adapt the default template id prior to execution.

www/extras/macro/users-online/*.gif - Images provided with the initial macro and that are still used by the two templates included. Some of the images have been renamed.

Templates/UsersOnline Default View.template - The default template which provides a view identical to the one of the original macro. Create a new Template somewhere in your import node and copy the content. Normally, this template is used by default. However, you need to adapt the default template id in UsersOnline.pm first.

Templates/UsersOnline Detailed View.template/.header - A detailed view which I composed mainly for the purpose of debugging.  Create a new Template somewhere in your import node and copy the content (template and header block).


It is further necessary to create a new boolean profile variable "showOnline"! That variable is queried by the macro and users will only be shown as online if the flag is set to true.

For documentation on how to use the macro have a look at the embedded documentation ($ perldoc UsersOnline). In most cases, a call without parameters should return the desired result.


Change Log

2008-10-03 (Version 1.2):

  • Added: Testing function
  • Changed: User Id of Admin account now hardcoded to 3
  • Fixed: Names of visitor and member loop in help module

2008-08-26 (Version 1.1):

  • Fixed: The number of online users is displayed correctly now.
  • Added: New template variables isVisitor and hasMembers
  • Added: Help module (English and German)
  • Code restructured for improved readibility

System Requirements

The macro has been tested with WebGUI 7.5.24 running on WRE 0.8.5. There are no known issues.

Comments
5xootom: "I've installed the UsersOnline macro, and after making a few changes it works well! Here are the changes I had to make. (I'm using 7.5.21).

my $adminId = 3, rather than looking for the Id of the username "Admin" (as mine's not called "Admin".)

Also hard-coded my server's IP address, the code didn't pick it up, it appears because my server's DNS host record is a PTR record not A.

I put apostrophes around the userId tests in the queries, just to ensure MySQL isn't comparing userId = 1 as =true, and if your Admin account has a GUID and not = 3, it breaks the query being a string.

The template vars for all the labels are formatted "label_xxx" in the macro, but "xxx_label" in the templates, I updated my templates accordingly.

The two queries that count the number of members and visitors always came out at 1 each on mine, it seemed to be the way the QuickArray was used (I don't know enough about Perl to know why). Instead of:
$var{'members'} = ...select count...
I had to change it to:
my ($count) = ...select count...
$var{'members'} = $count;
"
3xootom: "... I think I must have an old version of the Macro, it's not got any variable 'hasMembers' defined. So the above probably doesn't apply!"
DownloadUsersOnline081003.tar.gz UsersOnline081003.tar.gz
LinksDemo
Support
ScreenshotsUsersOnline.png
Statistics Downloads: 405
Views: 2357
Rating: 4
Updated: 10/2/2008
Keywords community macros
NavigationBack to the Bazaar
© 2018 Plain Black Corporation | All Rights Reserved