sp_OnlineStats

Important Note:  The contents of this document applies ONLY to version 5.x.x of Simple:Press.  It likely does NOT apply to version 6.x.x (our latest version).

Description

sp_OnlineStats() – Displays the online statistics Most Users Online, Currently Online, Browsing the same page, and members or members and guests online.

Usage

sp_OnlineStats($args=”, $mostLabel=”, $currentLabel=”, $browsingLabel=”, $guestLabel=”);

Arguments

$args – List of arguments for controlling display.
Type:
(string) (optional)
Default:
‘pMostClass’ => ‘spMostOnline’
‘pCurrentClass’ => ‘spCurrentOnline’
‘pBrowsingClass’ => ‘spCurrentBrowsing’
‘link_names’ => 1
‘usersOnly’ => 0
‘echo’ => 1
‘get’ = > 0

‘pMostClass’: CSS Class for Most users ever online Stats div.
‘pCurrentClass’: CSS Class for currently online Stats div.
‘pBrowsingClass’: CSS Class for browsing div.
‘link_names’: Flag to indicate whether members names will have a link to their profile or not. One (1) is true and the names will be listed with a link. Zero (0) is false and the names will be listed without a link.
‘usersOnly’: Flag to indicate whether or not to display only members or members and guests. One (1) is true and only members are displayed. Zero (0) is false allowing display of members and guests.
‘echo’: Flag to indicate whether to write out the generated html display code or just return the html display code. One (1) is true and causes the html display code to be written to the display. Zero (0) is false and causes the html display code to be returned instead of written out.
‘get’: Flag to indicate whether to short circuit the template tag display process and simply return data or to proceed with normal HTML display code generation. One (1) is true and the template tag display process is not done and data is returned. Zero (0) is false and normal html display code generation happens.

$mostLabel – Text displayed before showing Most Users ever online.
Type:
(string) (optional)
Default:
None

$currentLabel – Text displayed before the number of currently online users.
Type:
(string) (optional)
Default:
None

$browsingLabel – Text displayed before the number of users browsing this page.
Type:
(string) (optional)
Default:
None

$guestsLabel – Text displayed after the number of guests are displayed.
Type:
(string) (optional)
Default:
None

Special Notes

In standard supplied Simple:Press themes this is used in the footer (spFoot.php) of the forum pages but can be used elsewhere on a forum page.

Examples

Display all online statistics using the default arguments and displaying each statistic with preceding text for which they apply.

sp_OnlineStats('', __sp('Most Users Ever Online: '), __sp('Currently Online: '), __sp('Currently Browsing this Page: '), __sp('Guest(s)'));

Display all online statistics using the default arguments and adding a left align. Also displaying each statistic with preceding text for which they apply.

sp_OnlineStats('tagClass=spLeft', __sp('Most Users: '), __sp('Now Online: '), __sp('On this Page: '), __sp('NonMember(s)'));

Actions and Hooks Used in Template Tag

  • apply_filters(‘sph_OnlineStats_args’, $a) – Allows modification of the arguments to the template tag. $a contains the parsed arguments.
  • apply_filters(‘sph_OnlineStats’, $out, $a) – Allows modification of the display code just prior to being output/returned. $out will contain the html display code.

Changelog

Since Simple:Press version 5.0.

Codex page sync’d to code version 5.4.1.

Source Code

sp_OnlineStats() is located in simple-press/forum/content/sp-common-view-functions.php.

Posted in