Simple:Press Documentation

sp_MemberListRank

Description

sp_MemberListRank() – Displays user badges/ranks on the members list.

Usage

sp_MemberListRank($args=”, $label=”);

Arguments

Note: If the value of any of this function’s arguments/parameters or the placement of this function in standard supplied Simple:Press theme pages is to be changed, it is highly recommended that a Child Theme or a Custom Theme be developed to accept the changes.

$args – List of arguments for controlling display.
Type:
(string) (optional)
Default:
‘tagId’ => ‘spMembersListRank%ID%’
‘tagClass’ => ‘spInRowCount’
‘labelClass’ => ‘spInRowLabel’
‘rank’ => 1
‘rankClass’ => ‘spInRowRank’
‘badge’ => 1
‘badgeClass’ => ‘spImg’
‘stack’ => 1
‘order’ => ‘SNU’
‘showAll’ => 0
‘echo’ => 1
‘get’ => 0

tagId‘: CSS ID for Div. The %ID% is replaced by the user_id.
tagClass‘: CSS Class for Div.
labelClass‘: CSS class for Label before ranks and badges are displayed.
rank‘: Flag to indicate whether to display the ranks of the member. One (1) is true and the member’s ranks are displayed. Zero (0) is false and the member’s ranks are not displayed.
rankClass‘: CSS class for the rank.
badge‘: Flag to indicate whether or not to display the member’s badges. A one (1) will display the member’s badges. A zero (0) will not display the badges.
badgeClass‘: CSS class for the badge.
stack‘: Flag to indicate whether or not to stack the member’s ranks and associated badges under the label. A one (1) will display the elements to be shown under one another. A zero (0) will display the elements to be shown next to one another to the extent the width of the display area allows before wrapping to the next line.
order‘: Indicator of the order the ranks and badges will be shown. ‘SNU’ is the default for ‘S’pecial rank ‘N’ormal rank ‘U’serGroup badge. Any combination of the three (3) are valid selections. For example: ‘SUN’, ‘NSU’, etc. The badges shown are controlled by the ‘showAll’ argument.
showAll‘: Flag to indicate whether or not to display all the rank badges. A one (1) is true and allows all rank badges to be shown including the usergroup badge. The badges will be shown in the sequence specified by the ‘order’ argument. A zero (0) is false and the first badge found in order is the only one that is displayed.
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.

$label – Text displayed before the ranks and badges are displayed.
Type:
(string) (optional)
Default:
None

 

Special Notes

In most standard supplied Simple:Press themes this is used in the members page (‘spMembersView.php’). The exception is

  • the “Reboot” theme where this function is used in the ‘spMembersViewDesktop.php’ and the ‘spMembersViewMobile.php’ files instead of the ‘spMembersView.php’ file.

Examples

1). Using the defaults, display a member’s ranks and badges with the “label” of “Forum Ranks” in the desktop version of themes.

sp_MemberListRank('', __sp('Forum Ranks'));

2). Display a member’s ranks and badges with “tagClass” of “spInRowCount spRight”, “badgeClass” of “spImg spMembersBadgeMobile spRight”, “rankClass” of “spInRowRank spRight”, and without a “label” in the mobile version of themes.

sp_MemberListRank('tagClass=spInRowCount spRight&badgeClass=spImg spMembersBadgeMobile spRight&rankClass=spInRowRank spRight', '');

3). Using the child theme based on the “Default” theme, display all the member’s ranks and badges using “order” of “Usergroup Special Normal” with the “label” of “Ranks”.

A. Download the Default Child Framework and set it up as discussed in the Creating a Child Theme page. Copy the Default theme’s ‘spMembersView.php’ file over to the child theme and modify its “sp_MembersListRank()’ call to add “showAll” = “1” and “order” = “USN” as shown below and save.

sp_MemberListRank('showAll=1&order=USN', __sp('Ranks'));

Actions and Hooks Used in Template Tag

  • apply_filters(‘sph_MemberListRank_args’, $a) – Allows modification of the arguments to the template tag. $a contains the parsed arguments.
  • apply_filters(‘sph_MemberListRank’, $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.
Version 5.6.0: ‘order’ and ‘showAll’ arguments added.

Codex page sync’d to code version 5.6.1.

Source Code

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


Copyright © 2006-2020 Simple:Press. All Rights Reserved.