vBulletin v6.0.4

vB_Library_Notification extends vB_Library
in package

vB_Library_Notification

Tags
access

public

Table of Contents

Constants

DATASTOREKEY_TRIGGERS  = 'vBNotificationEvents'
DATASTOREKEY_TYPES  = 'vBNotificationTypes'

Methods

__serialize()  : array<string|int, mixed>
__sleep()  : array<string|int, mixed>
__unserialize()  : void
__wakeup()  : void
cleanupDefunctNotificationClasses()  : mixed
Go through `notificationtype` & `notificationevent` records and remove any classes that no longer exist. Useful when deleting or reoganizing notification types.
clearCache()  : mixed
deleteNotification()  : mixed
Deletes specified notificationds, ignoring ownership
fetchNotificationCountForUser()  : int
Returns the count of specified user's notifications based on provided filterParams
fetchNotificationsForCurrentUser()  : array<string|int, mixed>
Return current user's notifications from DB.
fetchTotalNotificationCountForUser()  : int
Returns the total count of specified user's notifications
generateUrlForUnsubscribe()  : string
getContentInstance()  : mixed
getDefaultTypes()  : mixed
Returns default notification types' classes
getInsertPerBulk()  : int
Returns class variable $insertsPerBulk. Also @see setInsertPerBulk()
getNotificationEvents()  : mixed
getNotificationQueue()  : array<string|int, mixed>
Returns the class variable $notificationQueue. Used for testing.
getNotificationTypes()  : mixed
insertNotificationEventsToDB()  : mixed
insertNotificationsToDB()  : mixed
Insert all items in $this->notificationQueue into the database.
insertNotificationTypeToDB()  : mixed
Only used during install/update. Insert this particular notification type into DB, populating the notificationtype, & notificationevent categories.
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.
setInsertPerBulk()  : mixed
Sets $this->insertsPerBulk, which is the maximum number of rows that insertNotificationsToDB() will insert into the DB in each database assert.
triggerNodeWordNotificationEvent()  : void
Conditionally triggers a notification event if the text matches the monitored words.
triggerNotificationEvent()  : mixed
triggerUserWordNotificationEvent()  : void
Conditionally triggers a notification event if the text matches the monitored words.

Constants

DATASTOREKEY_TRIGGERS

public mixed DATASTOREKEY_TRIGGERS = 'vBNotificationEvents'

DATASTOREKEY_TYPES

public mixed DATASTOREKEY_TYPES = 'vBNotificationTypes'

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>

cleanupDefunctNotificationClasses()

Go through `notificationtype` & `notificationevent` records and remove any classes that no longer exist. Useful when deleting or reoganizing notification types.

public cleanupDefunctNotificationClasses() : mixed

clearCache()

public static clearCache() : mixed

deleteNotification()

Deletes specified notificationds, ignoring ownership

public deleteNotification(int|array<string|int, int> $notificationids) : mixed
Parameters
$notificationids : int|array<string|int, int>

Array of notificationids to delete.

fetchNotificationCountForUser()

Returns the count of specified user's notifications based on provided filterParams

public fetchNotificationCountForUser(int $userid[, array<string|int, mixed> $data = [] ]) : int
Parameters
$userid : int
$data : array<string|int, mixed> = []

Optional. If not empty, should have

  • 'typeid'
Return values
int

fetchNotificationsForCurrentUser()

Return current user's notifications from DB.

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

Fields

  • 'sortDir' Optional String sort direction. If not "ASC", sort order will be DESC. The sort field is notification.lastsenttime
  • 'perpage' Optional unsigned integer results per page. Default is 20 per page.
  • 'page' Optional unsigned integer page # to return. Default is the first page.
  • 'showdetail' Optional boolean, set true to display details about node ratings.
  • 'about' Optional String legacy about string.
  • 'typename' Optional String Notification typename. If 'about' is set, that will be used instead. If a valid 'about & 'typename' is set, only notifications of that type will be returned.
  • 'readFilter' Optional String filter by new/dismissed status. If NOT SET, function will default to 'unread_only'. If is SET, the expected values are ('unread_only'| 'read_only'|'*'). If SET but not to 'unread_only' OR 'read_only', function will return both new & dismissed notifications.
  • 'skipIds' Optional Int[], only used internally by vB_Api_Notification::dismissNotification()
Return values
array<string|int, mixed>

Keyed by integer notificationid, contains all data from the notification table and possibly the following fields:

  • 'categoryname'
  • 'typename'
  • 'sender_username'
  • 'sender_displayname'
  • 'sender_avatarpath' For CONTENT category
  • 'aboutstartertitle'
  • 'aboutstarterrouteid'
  • 'otherParticipantsCount' For POLLVOTE category
  • 'votes' poll.votes for sentbynodeid
  • 'lastvote' poll.lastvote for sentbynodeid
  • 'otherVotersCount' For NODEACTION category's NODEACTION_LIKE type:
  • 'showdetail' Based on user's genericpermissions.canseewholiked permission
  • 'totalRatersCount'
  • 'otherRatersCount'

.. TODO finish this docblock

fetchTotalNotificationCountForUser()

Returns the total count of specified user's notifications

public fetchTotalNotificationCountForUser(int $userid) : int
Parameters
$userid : int
Return values
int

generateUrlForUnsubscribe()

public generateUrlForUnsubscribe(int $sentbynodeid) : string
Parameters
$sentbynodeid : int
Return values
string

getContentInstance()

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

getDefaultTypes()

Returns default notification types' classes

public getDefaultTypes() : mixed
Tags
returns

String[] Class names

getInsertPerBulk()

Returns class variable $insertsPerBulk. Also @see setInsertPerBulk()

public getInsertPerBulk() : int
Return values
int

getNotificationEvents()

public getNotificationEvents() : mixed

getNotificationQueue()

Returns the class variable $notificationQueue. Used for testing.

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

@see $notificationQueue

getNotificationTypes()

public getNotificationTypes() : mixed

insertNotificationEventsToDB()

public insertNotificationEventsToDB(mixed $class) : mixed
Parameters
$class : mixed

insertNotificationsToDB()

Insert all items in $this->notificationQueue into the database.

public insertNotificationsToDB() : mixed

The actual bulk of this function should probably live in the vBForum querydefs file.

insertNotificationTypeToDB()

Only used during install/update. Insert this particular notification type into DB, populating the notificationtype, & notificationevent categories.

public insertNotificationTypeToDB(string $class) : mixed
Parameters
$class : string

Class name of the new notification type. The class must be a subclass of vB_Notification, and placed in a location the auto-loader can find.

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.

setInsertPerBulk()

Sets $this->insertsPerBulk, which is the maximum number of rows that insertNotificationsToDB() will insert into the DB in each database assert.

public setInsertPerBulk(int $newInsertsPerBulk) : mixed

Set this before calling insertNotificationsToDB() to affect the inserts.

Parameters
$newInsertsPerBulk : int

Will have no affect if smaller than 1.

triggerNodeWordNotificationEvent()

Conditionally triggers a notification event if the text matches the monitored words.

public triggerNodeWordNotificationEvent(string $subtype, string|array<string|int, mixed> $text, int $nodeid, int $senderid) : void

This does not validate that the text is in anyway associated with the node, that is the callers responsibility

Parameters
$subtype : string

-- what portion of the node text are we matching @param array|string $text -- string or array of strings containing the text to check @param int $nodeid -- The node potentially being flagged @param int $senderid -- The user performing the task potentially triggering the notification.

$text : string|array<string|int, mixed>
$nodeid : int
$senderid : int

triggerNotificationEvent()

public triggerNotificationEvent(string $eventstring[, array<string|int, mixed> $data = [] ][, array<string|int, int> $recipients = [] ]) : mixed
Parameters
$eventstring : string
$data : array<string|int, mixed> = []

Array of event data, or notification data Expected for notification data: - int sentbynodeid - int sender

$recipients : array<string|int, int> = []

List of recipients, only required for content-less notification types, like SenderAcceptedFollow, SenderAcceptedFollow

triggerUserWordNotificationEvent()

Conditionally triggers a notification event if the text matches the monitored words.

public triggerUserWordNotificationEvent(string $subtype, string|array<string|int, mixed> $text, int $targetuserid, int $senderid) : void

This does not validate that the text is in anyway associated with the user, that is the callers responsibility

Parameters
$subtype : string

-- what portion of the node text are we matching @param array|string $text -- string or array of strings containing the text to check @param int $targetuserid -- The user potentially being flagged. @param int $senderid -- The user performing the task potentially triggering the notification.

$text : string|array<string|int, mixed>
$targetuserid : int
$senderid : int

        
On this page

Search results