sp_UserSpecialRank

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_UserSpecialRank – This function is used to display a user’s special ranks.

Usage

sp_UserSpecialRank($args=”, $ranks=”);

Arguments

$args – List of arguments for controlling display.
Type:
(string) (optional)
Default:
‘tagClass’ => ‘spSpecialRank’
‘titleClass’ => ‘spSpecialRank’
‘badgeClass’ => ‘spSpecialRank’
‘showTitle’ => 1
‘showBadge’ => 1
‘echo’ => 1

‘tagClass’: Class to apply to the forum rank container div.
‘titleClass’: Class to apply to the p tag surrounding the rank title.
‘badgeClass’: Class to apply to the img tag for the rank badge.
‘showTitle’: Flag to indicate whether or not to show the title of the special rank. One (1) is true and the title of the special rank is shown. Zero (0) is false and the title is not shown.
‘showBadge’: Flag to indicate whether or not to show the Badge of the special rank. One (1) is true and the Badge of the special rank is shown. Zero (0) is false and the Badge is not shown.
‘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.

$ranks – The array containing the special ranks to be displayed. This array is typically contained within an sp user class. Array elements should contain the rank ‘name’ and ‘badge’, the latter being url to the badge image.
Type:
(array) (required)
Default:
None

Special Notes

The special ranks for the user are typically contained with the current user object (ie $spThisUser or $spThisPostUser or other).

Examples

Output the forum rank for the current profile user.

sp_UserSpecialRank($args='', $spProfileUser->rank)

Output the special rank for the current poster with only the badge and no title.

sp_UserSpecialRank($args='showTitle=0', $spThisPostUser->rank)

Actions and Hooks Used in Template Tag

  • apply_filters(‘sph_SpecialRank_args’, $a) – Allows modification of the arguments to the template tag. $a contains the parsed arguments.
  • apply_filters(‘sph_SpecialRank’, $out, $ranks, $a) – Allows modification of the special rank display code just prior to being output/returned. $out will contain the html display code. $ranks contains the passed in special ranks array.

Changelog

Since Simple:Press version 5.0.

Codex page sync’d to code version 5.4.1.

Source Code

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

Related

sp_UserForumRank
sp_PostIndexUserRank
sp_PostIndexUserSpecialRank

Posted in