vBulletin v6.0.4

vB_Library_Userrank extends vB_Library
in package

vB_Libary_Userrank

Tags
access

public

Table of Contents

Methods

__serialize()  : array<string|int, mixed>
__sleep()  : array<string|int, mixed>
__unserialize()  : void
__wakeup()  : void
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()  : static
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

Methods

__serialize()

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

__sleep()

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

__unserialize()

public __unserialize(array<string|int, mixed> $serialized) : void
Parameters
$serialized : array<string|int, mixed>

clearCache()

public static clearCache() : mixed

delete()

Delete an user rank

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

The ID of user rank to be deleted

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.

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

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

instance()

Returns singleton instance of self.

public static instance(mixed $class) : static
Parameters
$class : mixed
Return values
static
  • Reference to singleton instance of the requested library class

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 = 0 ]) : mixed
Parameters
$text : mixed
$type : mixed
$nodeid : mixed
$userid : mixed = null
$insertNotifications : mixed = true
$currentuserid : mixed = 0
Tags
deprecated

use the functions from the notification library directly.

save()

Insert a new user rank or update existing user rank

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

User rank data to be inserted or updated 'grouping' => Grouping tag 'priority' => Priority for grouped user ranks 'ranklevel' => Number of times to repeat rank 'usergroupid' => Usergroup 'minposts' => Minimum Posts 'startedtopics' => Minimum Topics 'registrationtime' => Minimum time since registration, in seconds 'reputation' => Minimum Reputation Level 'totallikes' => Minimum Likes from other users '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 = 0

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


        
On this page

Search results