sp_LoggedInOutLabel

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_LoggedInOutLabel() – This function is used to display the current user’s logged in/out status message.

Usage

sp_LoggedInOutLabel($args=”, $inLabel=”, $outLabel=”, $outLabelMember=”);

Arguments

$args – List of arguments for controlling display.
Type:
(string) (optional)
Default:
‘tagId’ => ‘spLoggedInOutLabel’
‘tagClass’ => ‘spLabel’
‘echo’ => 1

‘tagId’: ID to apply to the container div for the label.
‘tagClass’: Class to apply to the container div for the label.
‘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.

$inLabel – Message to display to logged in users.
Type:
(string) (optional)
Default:
None

$outLabel – Message to display to non logged in guests visiting the forum.
Type:
(string) (optional)
Default:
None

$outLabelMember – Message to display to recognized users (via cookie) who are visiting the forum, but are not logged in.
Type:
(string) (optional)
Default:
None

Special Notes

The $outLabelMember only comes in to play if you are disallowing logged in members to post as guests on the forum – options – member settings admin panel.

If you want to personalize the message to logged in users or recognized logged out users, you can use %USERNAME% in the text string and it will be replaced by the user’s display name.

Examples

Output a logged in/out message to users, guests and offline members with a class of ‘spLabelSmall’ and ‘spLeft’ on the container div.

sp_LoggedInOutLabel('tagClass=spLabelSmall spLeft', 'Logged in as %USERNAME%', 'Please consider registering guest', 'Welcome back %USERNAME% Please log in to post');

Actions and Hooks Used in Template Tag

  • apply_filters(‘sph_LoggedInOutLabel_args’, $a) – Allows modification of the arguments to the template tag. $a contains the parsed arguments.
  • apply_filters(‘sph_LoggedInOutLabel’, $out, $a) – Allows modification of the label/message 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_LoggedInOutLabel() is located in simple-press/forum/content/sp-common-view-functions.php.

Related

sp_LogInOutButton
sp_RegisterButton
sp_LoginForm
sp_LastVisitLabel

Posted in