Table of Contents
whoisonline Plugin
Compatible with DokuWiki
- 2023-04-04 "Jack Jackrum" unknown
- 2022-07-31 "Igor" yes
- 2020-07-29 "Hogfather" no
- 2018-04-22 "Greebo" yes
Similar to onlinenumber
For Hogfather and Igor support
- Edit
lib/plugins/whoisonline/syntax.php
and replace (line 108 & 123)public function handle($match, $state, $pos, $handler) { public function render($mode, $renderer, $data) {
- with
public function handle($match, $state, $pos, Doku_Handler $handler) { public function render($mode, Doku_Renderer $renderer, $data) {
Installation
Copy the whoisonline folder into the /lib/plugins folder and that should do it. Please keep the name the same since the ajax portion is specifically looking for that location. The plugin uses a file to store the active users, no database necessary.
Search and install the plugin using the Extension Manager. Refer to Plugins on how to install plugins manually.
Examples/Usage
For just a simple display of the online count add this:
~~whoisonline:NOLIST~~
If you want a popup list when you hover over the button just use this:
~~whoisonline~~
The popup list can be customized in the admin configuration. The default is {username}
, but you can add all sorts of HTML to make it link to places. Here is what I use on my site…
<a href="/users:{username}">{fullname}</a> - <a href="/{pageid}">{pageid}</a>
This will make the popup list have their fullname that links to their user page on the wiki, and then the current page they are looking at which you can click to.
If you want to track the users but not show the count or the list just add the NOSHOW option on some footer to record their presence, then you can do the regular ~~whoisonline~~
on an admin page to view the results.
~~whoisonline:NOSHOW~~
Syntax
Basic syntax:
~~whoisonline~~ ~~whoisonline:nolist~~ ~~whoisonline:noshow~~
Configuration and Settings
By default the plugin only tracks users that are logged in. You can track anonymous users by IP address if you uncheck the IgnoreAnonymous option in the admin configuration screen.
By default the users are considered idle if they are not seen by the plugin for 5 minutes. You can change this setting in the admin configuration screen.
Check the styles.css to adjust any formatting. I use this in the sidebar so the width is set to 100% to fill the sidebar. That may not do in your situation.
Change Log
- 2013-06-20
- Initial release
Known Bugs and Issues
ToDo/Wish List
- Tie into a sql database for large user bases
- Make a buddy list option
- Add more fields for display line
- Add some grouping or sorting options
- Add other languages
FAQ
The idea from this came from this link http://tutorialzine.com/2010/03/who-is-online-widget-php-mysql-jquery/ which had a great code example. I formatted it for my needs and made a Dokuwiki plugin out of it.
Adding Email to Substitution List
On line 48 of syntax.php, replace:
if( isset($INFO['userinfo']) || ($this->getConf('ignoreAnonymous')==0)){ $userdisplay = str_replace( array( "{username}" , "{pageid}" , "{fullname}" , "{url}" ) , array( $INFO["client"] , $INFO["id"] , $INFO["userinfo"]["name"] , $_SERVER["REQUEST_URI"] ) , $displaypattern );
with:
if( isset($INFO['userinfo']) || ($this->getConf('ignoreAnonymous')==0)){ $userdisplay = str_replace( array( "{username}" , "{pageid}" , "{fullname}" , "{email}" , "{url}" ) , array( $INFO["client"] , $INFO["id"] , $INFO["userinfo"]["name"] , $INFO["userinfo"]["mail"] , $_SERVER["REQUEST_URI"] ) , $displaypattern );
on line 10 of settings.php
replace:
$lang['displayline'] = 'HTML to use when making the popup user list. Possible replacement strings are: {username}, {fullname}, {pageid}, {url}';
with:
$lang['displayline'] = 'HTML to use when making the popup user list. Possible replacement strings are: {username}, {fullname}, {email}, {pageid}, {url}';