CreatePost_Notify
extends BackgroundTask
in package
This class contains code used to notify people when a new post is created that is relevant to them in some way: new topics in boards they watch, replies to topics they watch, posts that mention them, and/or posts that quote them.
Table of Contents
Constants
- FREQUENCY_DAILY_DIGEST = 3
- FREQUENCY_EVERYTHING = 1
- FREQUENCY_FIRST_UNREAD_MSG = 2
- FREQUENCY_NOTHING = 0
- Constants for frequencies.
- FREQUENCY_WEEKLY_DIGEST = 4
- MENTION_DELAY = 5
- Minutes to wait before sending notifications about mentions and quotes in unwatched and/or edited posts.
- NOTIFY_TYPE_NOTHING = 4
- NOTIFY_TYPE_ONLY_REPLIES = 3
- NOTIFY_TYPE_REPLIES_AND_MODERATION = 1
- Constants for reply types.
- NOTIFY_TYPE_REPLIES_AND_OWN_TOPIC_MODERATION = 2
- RECEIVE_NOTIFY_ALERT = 0x1
- RECEIVE_NOTIFY_EMAIL = 0x2
- Constants for notification types.
Properties
- $_details : array<string|int, mixed>
- $alert_rows : array<string|int, mixed>
- $members : array<string|int, mixed>
- $mention_mail_time : int
- $prefs : array<string|int, mixed>
Methods
- __construct() : mixed
- The constructor.
- execute() : bool
- This executes the task: loads up the info, puts the email in the queue and inserts any alerts as needed.
- getMinUserInfo() : array<string|int, mixed>
- Loads minimal info for the previously loaded user ids
- handleMentionedNotifications() : void
- Notifies members when they are mentioned in other members' posts.
- handleQuoteNotifications() : void
- Notifies members when their posts are quoted in other posts.
- handleWatchedNotifications() : void
- Notifies members about new posts in topics they are watching and new topics in boards they are watching.
- updateAlerts() : void
- Update an alert if a message was updated since the alert was created.
Constants
FREQUENCY_DAILY_DIGEST
public
mixed
FREQUENCY_DAILY_DIGEST
= 3
FREQUENCY_EVERYTHING
public
mixed
FREQUENCY_EVERYTHING
= 1
FREQUENCY_FIRST_UNREAD_MSG
public
mixed
FREQUENCY_FIRST_UNREAD_MSG
= 2
FREQUENCY_NOTHING
Constants for frequencies.
public
mixed
FREQUENCY_NOTHING
= 0
FREQUENCY_WEEKLY_DIGEST
public
mixed
FREQUENCY_WEEKLY_DIGEST
= 4
MENTION_DELAY
Minutes to wait before sending notifications about mentions and quotes in unwatched and/or edited posts.
public
mixed
MENTION_DELAY
= 5
NOTIFY_TYPE_NOTHING
public
mixed
NOTIFY_TYPE_NOTHING
= 4
NOTIFY_TYPE_ONLY_REPLIES
public
mixed
NOTIFY_TYPE_ONLY_REPLIES
= 3
NOTIFY_TYPE_REPLIES_AND_MODERATION
Constants for reply types.
public
mixed
NOTIFY_TYPE_REPLIES_AND_MODERATION
= 1
NOTIFY_TYPE_REPLIES_AND_OWN_TOPIC_MODERATION
public
mixed
NOTIFY_TYPE_REPLIES_AND_OWN_TOPIC_MODERATION
= 2
RECEIVE_NOTIFY_ALERT
public
mixed
RECEIVE_NOTIFY_ALERT
= 0x1
RECEIVE_NOTIFY_EMAIL
Constants for notification types.
public
mixed
RECEIVE_NOTIFY_EMAIL
= 0x2
Properties
$_details
protected
array<string|int, mixed>
$_details
Holds the details for the task
$alert_rows
private
array<string|int, mixed>
$alert_rows
= []
Alerts to be inserted into the alerts table.
$members
private
array<string|int, mixed>
$members
= [
// These three contain nested arrays of member info.
'mentioned' => [],
'quoted' => [],
'watching' => [],
// These ones just contain member IDs.
'all' => [],
'emailed' => [],
'alerted' => [],
'done' => [],
]
Info about members to be notified.
$mention_mail_time
private
int
$mention_mail_time
= 0
Timestamp after which email notifications should be sent about mentions and quotes in unwatched and/or edited posts.
$prefs
private
array<string|int, mixed>
$prefs
= []
Members' notification and alert preferences.
Methods
__construct()
The constructor.
public
__construct(array<string|int, mixed> $details) : mixed
Parameters
- $details : array<string|int, mixed>
-
The details for the task
execute()
This executes the task: loads up the info, puts the email in the queue and inserts any alerts as needed.
public
execute() : bool
Tags
Return values
bool —Always returns true.
getMinUserInfo()
Loads minimal info for the previously loaded user ids
public
getMinUserInfo([array<string|int, mixed> $user_ids = [] ]) : array<string|int, mixed>
Parameters
- $user_ids : array<string|int, mixed> = []
Tags
Return values
array<string|int, mixed>handleMentionedNotifications()
Notifies members when they are mentioned in other members' posts.
protected
handleMentionedNotifications() : void
handleQuoteNotifications()
Notifies members when their posts are quoted in other posts.
protected
handleQuoteNotifications() : void
handleWatchedNotifications()
Notifies members about new posts in topics they are watching and new topics in boards they are watching.
protected
handleWatchedNotifications() : void
updateAlerts()
Update an alert if a message was updated since the alert was created.
private
updateAlerts(int $msg_id) : void
Parameters
- $msg_id : int
-
Message ID to update