vBulletin 5.6.5 API

vB_Library_Userrank extends vB_Library
in package

vB_Libary_Userrank

Tags
access

public

Table of Contents

$instance  : mixed
__serialize()  : mixed
__sleep()  : mixed
__unserialize()  : mixed
__wakeup()  : mixed
clearCache()  : mixed
delete()  : void
Delete an user rank
deleteForUsergroup()  : mixed
Delete all user ranks based for a given usergroup
fetchAll()  : array<string|int, mixed>
Fetch All user ranks
fetchById()  : array<string|int, mixed>
Fetch Userrank By RankID
getContentInstance()  : mixed
getRankHtml()  : string
Gets the current rank for a user.
haveRanks()  : mixed
Determines if we have ranks defined in the system. This allows us to determine if we even need to worry about changing a user's rank.
instance()  : vB_PageCache
Returns singleton instance of self.
monitorWords()  : mixed
Checks if the text contains monitored words, and if so, sends notifications to admins and moderators if the setting is on.
save()  : int
Insert a new user rank or update existing user rank
__construct()  : mixed
getLibraryClassNameInternal()  : mixed
buildRanks()  : mixed
Rebuild the rank datastore entry

Properties

$instance

protected static mixed $instance = array()

Methods

__serialize()

public __serialize() : mixed
Return values
mixed

__sleep()

public __sleep() : mixed
Return values
mixed

__unserialize()

public __unserialize(mixed $serialized) : mixed
Parameters
$serialized : mixed
Return values
mixed

__wakeup()

public __wakeup() : mixed
Return values
mixed

clearCache()

public static clearCache() : mixed
Return values
mixed

delete()

Delete an user rank

public delete(int $rankid) : void
Parameters
$rankid : int

The ID of user rank to be deleted

Return values
void

deleteForUsergroup()

Delete all user ranks based for a given usergroup

public deleteForUsergroup(int $usergroupid) : mixed

This is primarily intended for cleanup when a usergroup is deleted.

Parameters
$usergroupid : int

The usergroup to clear the ranks for.

Return values
mixed

fetchAll()

Fetch All user ranks

public fetchAll() : array<string|int, mixed>
Return values
array<string|int, mixed>

Array of user ranks

fetchById()

Fetch Userrank By RankID

public fetchById(int $rankid) : array<string|int, mixed>
Parameters
$rankid : int

Rank ID

Return values
array<string|int, mixed>

User rank information

getContentInstance()

public static getContentInstance(mixed $contenttypeid) : mixed
Parameters
$contenttypeid : mixed
Return values
mixed

getRankHtml()

Gets the current rank for a user.

public getRankHtml( $userinfo) : string

Intended to allow updating the user after a change is made.

We use the following logic to find the ranks for a user.

A rank is a match if
* We our user has greater than or equal to the min post count for the rank
  • We are a member of the ranks group (or the rank is set to all user groups)
  • If we are set to only match the display group then our display group is the same as the rank group If the rank is set to "all groups" and set to only match a display group then we match the rank if we have not matched a previous rank.

Additionally we will not consider any ranks if we have previously matched a rank for the same usergroup with a higher minimum post count. If there are several ranks with the same user group and post count that match we will select all of them if they are the highest that match. For this purpose ranks set to "all groups" are considered their own usergroup (that is we will select up to one rank per usergroup and one for "all usergroups" assuming we do not select multiple ranks with the same postcount).

Note that there is undocumented (in the UI) behavior surrounding the seemingly nonsensical combination of "all groups" and "display group = this group". We specifically only match the group if we haven't matched a previous ranks (for any usergroup, not just "all groups"). As an additional quirk, if we would match an "all group" rank with a lower post count and without the display group flag set we will match the rank with the display group flag instead, which seems inconsistant (this is because we encounter the higher post cont rank first in process order and make a decision on it before looking at the ranks farther down -- and when we encounter the lower ranks we've already selected the higher count rank for all groups and therefore we do not consider the lower rank for inclusion).

This behavior was clearly done for a reason (based the specifical inclusion of code to handle that case), however the reasons for it are lost to history. It does not appear to be a widely used case in the wild. The current thinking is that it is not a useful feature and we should consider it an error to enter a rank in that state. The logic has not yet been changed to reflect this (its been that way for a long time and doesn't appear to be hurting anything).

Parameters
$userinfo :

-- The user info array. We only actually use the following fields

  • posts
  • usergroupid
  • displaygroupid
  • membergroupids
Return values
string

The user rank html

haveRanks()

Determines if we have ranks defined in the system. This allows us to determine if we even need to worry about changing a user's rank.

public haveRanks() : mixed
Return values
mixed

instance()

Returns singleton instance of self.

public static instance(mixed $class) : vB_PageCache
Parameters
$class : mixed
Return values
vB_PageCache
  • Reference to singleton instance of the cache handler

monitorWords()

Checks if the text contains monitored words, and if so, sends notifications to admins and moderators if the setting is on.

public monitorWords(mixed $text, mixed $type, mixed $nodeid[, mixed $userid = null ][, mixed $insertNotifications = true ], mixed $currentuserid) : mixed
Parameters
$text : mixed
$type : mixed
$nodeid : mixed
$userid : mixed = null
$insertNotifications : mixed = true
$currentuserid : mixed
Return values
mixed

save()

Insert a new user rank or update existing user rank

public save(array<string|int, mixed> $data, int $rankid) : int
Parameters
$data : array<string|int, mixed>

User rank data to be inserted or updated 'ranklevel' => Number of times to repeat rank 'usergroupid' => Usergroup 'minposts' => Minimum Posts 'stack' => Stack Rank. Boolean. 'display' => Display Type. 0 - Always, 1 - If Displaygroup = This Group 'rankimg' => User Rank File Path (only used if rankhtml is empty) 'rankhtml' => User Rank HTML Text (if not empty rankimg will be ignored)

$rankid : int

If not 0, it's the ID of the user rank to be updated

Return values
int

New rank's ID or updated rank's ID

__construct()

protected __construct() : mixed
Return values
mixed

getLibraryClassNameInternal()

protected static getLibraryClassNameInternal(mixed $controller) : mixed
Parameters
$controller : mixed
Return values
mixed

buildRanks()

Rebuild the rank datastore entry

private buildRanks() : mixed

Must be called after any operation that changes the rank table

Return values
mixed

Search results