__construct()
addConversationReplyToRecipients()
addFetchOptionJoin()
addPositionLimit()
allowedAdditionalConversationRecipients()
assertValidCutOffOperator()
canEditConversation()
canEditMessage()
canInviteUsersToConversation()
canManageReportedMessage()
canReplyToConversation()
canReportMessage()
canStartConversationWithUser()
canStartConversations()
canUploadAndManageAttachment()
canViewAttachmentOnConversation()
canViewAttachmentOnConversationMessage()
countConversationsForUser()
countMessagesBeforeDateInConversation()
countUnreadConversationsForUser()
create()
deleteConversationForUser()
fetchAllKeyed()
findConversationRecipientsForUser()
findConversationRespondersForUser()
findConversationStartersForUser()
getAndMergeAttachmentsIntoConversationMessages()
getAttachmentParams()
getConditionsForClause()
getContentTypeField()
getContentTypesWithField()
getConversationForUser()
getConversationMasterById()
getConversationMessageById()
getConversationMessages()
getConversationRecipient()
getConversationRecipients()
getConversationsForUser()
getConversationsForUserByIds()
getLastPageNumbers()
getMaximumMessageDate()
getModelFromCache()
getNewestConversationMessagesAfterDate()
getNextMessageInConversation()
getOrderByClause()
getQuoteForConversationMessage()
insertConversationAlert()
insertConversationRecipient()
limitQueryResults()
markConversationAsRead()
markConversationAsUnread()
prepareConversation()
prepareConversationConditions()
prepareConversationFetchOptions()
prepareConversations()
prepareLimitFetchOptions()
prepareMessage()
prepareMessages()
prepareStateLimitFromConditions()
rebuildUnreadConversationCountForUser()
resetLocalCacheData()
setAllowCachedRead()
setLocalCacheData()
standardizeNodePermissionsAndUserId()
standardizePermissionCombinationIdAndUserId()
standardizePermissionsAndUserId()
standardizeViewingUserReference()
standardizeViewingUserReferenceForNode()
unserializePermissionsInList()
_getAlertModel()
_getAttachmentModel()
_getCache()
_getDataRegistryModel()
_getDb()
_getLocalCacheData()
_getUserModel()
_getUsersMatchingCriteria()
_updateConversationReadDate()
$_allowCachedRead
$_cache
$_db
$_localCacheData
$_modelCache
FETCH_FIRST_MESSAGE
FETCH_LAST_MESSAGE_AVATAR
FETCH_RECEIVED_BY
Model for conversations.
Models don't share that much, so most implementations will be adding methods onto this class. This class simply provides helper methods for common actions.
package | XenForo_Conversation |
---|
__construct()
Use create() statically unless you know what you're doing.
inherited_from | \XenForo_Model::__construct() |
---|
addConversationReplyToRecipients(array $conversation, array $replyUser, array $messageInfo) : array
array
Conversation info
array
null
Information about the user who replied
array
null
Array containing 'message', which is the text the message being sent
array
$recipientsaddFetchOptionJoin(array $fetchOptions, integer $join)
Join should be one of the constants.
inherited_from | \XenForo_Model::addFetchOptionJoin() |
---|
array
integer
addPositionLimit(string $table, integer $limit, integer $offset, string $column) : string
It no limit value is specified, nothing will be returned.
This must be added within a WHERE clause. If a clause is required, it will begin with "AND", so ensure there is a condition before it.
inherited_from | \XenForo_Model::addPositionLimit() |
---|
string
Name of the table alias to prefix. May be blank for no table reference.
integer
Number of records to limit to; ignored if <= 0
integer
Offset from the start of the records. 0+
string
Name of the column that is storing the position
string
Position limit clause if neededallowedAdditionalConversationRecipients(array $conversation, array $viewingUser) : integer
array
Conversation; if empty array, assumes new conversation
array
null
integer
-1 means unlimited; 0 is no more invites; other is remaining countassertValidCutOffOperator(string $operator)
inherited_from | \XenForo_Model::assertValidCutOffOperator() |
---|
string
canEditConversation(array $conversation, string $errorPhraseKey, array $viewingUser) : boolean
Does not check conversation viewing permissions.
array
string
Returned phrase key for a specific error
array
null
boolean
canEditMessage(array $message, array $conversation, string $errorPhraseKey, array $viewingUser) : boolean
array
array
string
array
null
boolean
canInviteUsersToConversation(array $conversation, string $errorPhraseKey, array $viewingUser) : boolean
Does not check conversation viewing permissions.
array
string
Returned phrase key for a specific error
array
null
boolean
canManageReportedMessage(array $message, array $conversation, string $errorPhraseKey, array $viewingUser) : boolean
array
array
string
array
null
boolean
canReplyToConversation(array $conversation, string $errorPhraseKey, array $viewingUser) : boolean
Does not check conversation viewing permissions.
array
string
Returned phrase key for a specific error
array
null
boolean
canReportMessage(array $message, array $conversation, boolean $errorPhraseKey, array $viewingUser) : boolean
array
array
boolean
string
array
null
boolean
canStartConversationWithUser(array $user, string $errorPhraseKey, array $viewingUser) : boolean
Does not check standard conversation permissions.
array
string
array
null
boolean
canStartConversations(string $errorPhraseKey, array $viewingUser) : boolean
string
array
null
boolean
canUploadAndManageAttachment(array $conversation, string $errorPhraseKey, array $viewingUser) : boolean
If no permissions are specified, permissions are retrieved from the currently visiting user. This does not check viewing permissions.
array
Info about the conversation posting in
string
Returned phrase key for a specific error
array
null
boolean
canViewAttachmentOnConversation(array $conversation, string $errorPhraseKey, array $viewingUser) : boolean
array
string
array
null
boolean
canViewAttachmentOnConversationMessage(array $message, array $conversation, string $errorPhraseKey, array $viewingUser) : boolean
array
array
string
array
null
boolean
countConversationsForUser(integer $userId, array $conditions) : integer
integer
array
Conditions for the WHERE clause
integer
countMessagesBeforeDateInConversation(integer $conversationId, integer $messageDate) : integer
integer
integer
integer
countUnreadConversationsForUser(integer $userId) : integer
integer
integer
create(string $class) : \XenForo_Model
The class must exist or be autoloadable or an exception will be thrown.
inherited_from | \XenForo_Model::create() |
---|
string
Class to load
deleteConversationForUser(integer $conversationId, integer $userId, string $deleteType)
If all users have deleted the conversation, it will be completely removed.
integer
integer
string
Type of deletion (either delete, or delete_ignore)
fetchAllKeyed(string $sql, string $key, mixed $bind, string $nullPrefix) : array
The 'key' parameter provides the column name with which to key the result. For example, calling fetchAllKeyed('SELECT item_id, title, date FROM table', 'item_id') would result in an array keyed by item_id: [$itemId] => array('item_id' => $itemId, 'title' => $title, 'date' => $date)
Note that the specified key must exist in the query result, or it will be ignored.
inherited_from | \XenForo_Model::fetchAllKeyed() |
---|
string
SQL to execute
string
Column with which to key the results array
mixed
Parameters for the SQL
string
If the key is null, prefix the counter with this
array
findConversationRecipientsForUser(integer $userId, string $searchString) : array
integer
string
array
findConversationRespondersForUser(integer $userId, string $searchString) : array
integer
string
array
findConversationStartersForUser(integer $userId, string $searchString) : array
integer
string
array
getAndMergeAttachmentsIntoConversationMessages(array $messages) : array
The attachments key will not be set if no attachments are found for the message.
array
array
Messages, with attachments added where necessarygetAttachmentParams(array $conversation, array $contentData, array $viewingUser) : array | false
array
array
Information about the content, for URL building
array
null
array
false
getConditionsForClause(array $sqlConditions) : string
This always returns a value that can be used in a clause such as WHERE.
inherited_from | \XenForo_Model::getConditionsForClause() |
---|
array
string
getContentTypeField(string $contentType, string $fieldName) : string | false
inherited_from | \XenForo_Model::getContentTypeField() |
---|
string
string
string
false
getContentTypesWithField(string $fieldName) : array
inherited_from | \XenForo_Model::getContentTypesWithField() |
---|
string
array
Format: [content type] => field valuegetConversationForUser(integer $conversationId, integer | array $viewingUser, array $fetchOptions) : array | false
integer
integer
array
Can be a user array, or a user ID (for B.C. purposes)
array
Options for extra data to fetch
array
false
getConversationMasterById(integer $conversationId) : array | false
integer
array
false
getConversationMessageById(integer $messageId) : array | false
integer
array
false
getConversationMessages(integer $conversationId, array $fetchOptions) : array
integer
array
Options for extra data to fetch
array
Format [message id] => infogetConversationRecipient(integer $conversationId, integer $userId, array $fetchOptions) : array | false
integer
integer
array
Options for extra data to fetch
array
false
getConversationRecipients(integer $conversationId, array $fetchOptions) : array
integer
array
Options for extra data to fetch
array
Format: [user id] => infogetConversationsForUser(integer $userId, array $conditions, array $fetchOptions) : array
integer
array
Conditions for the WHERE clause
array
Options for extra data to fetch
array
Format: [conversation id] => infogetConversationsForUserByIds(integer $userId, array $conversationIds) : array
integer
array
array
Format: [conversation id] => infogetLastPageNumbers(integer $replyCount) : array | boolean
integer
array
boolean
getMaximumMessageDate(array $messages) : integer
array
integer
Max message date timestamp; 0 if no messagesgetModelFromCache(string $class) : \XenForo_Model
If it does not exist, it will be instantiated.
inherited_from | \XenForo_Model::getModelFromCache() |
---|
string
Name of the class to load
getNewestConversationMessagesAfterDate(integer $conversationId, integer $date, array $fetchOptions) : array
integer
integer
array
array
[message id] => infogetNextMessageInConversation(integer $conversationId, integer $messageDate) : array | false
This is useful for finding the first unread message, for example.
integer
integer
Finds first message posted after this
array
false
getOrderByClause(array $choices, array $fetchOptions, string $defaultOrderSql) : string
inherited_from | \XenForo_Model::getOrderByClause() |
---|
array
array
string
string
Order by clause or empty stringgetQuoteForConversationMessage(array $message, integer $maxQuoteDepth) : string
array
integer
Max depth of quotes (-1 for unlimited)
string
insertConversationAlert(array $conversation, array $alertUser, string $action, array $triggerUser, array $extraData, array $messageInfo)
array
array
User to notify
string
Action taken out (values: insert, reply, join)
array
null
User triggering the alert; defaults to last user to reply
array
null
array
null
Array containing the text of the message being sent (if applicable) as 'message'
insertConversationRecipient(array $conversation, $userId, array $existingRecipient, string $insertState) : boolean
array
Conversation info
array
Information about the existing recipient record (if there is one)
string
State to insert the conversation for with this user
boolean
True if an insert was required (may be false if user is already an active recipient or is ignoring)limitQueryResults(string $query, integer $limit, integer $offset) : string
If the limit value is 0 or less, no clause is applied.
inherited_from | \XenForo_Model::limitQueryResults() |
---|
string
SQL query to run
integer
Number of records to limit to; ignored if <= 0
integer
Offset from the start of the records. 0+
string
Query with limit applied if necessarymarkConversationAsRead(integer $conversationId, integer $userId, integer $newReadDate, integer $lastMessageDate, boolean $updateVisitor)
integer
integer
integer
Timestamp to mark as read until
integer
Date of last message; only marks whole conversation read if more than this date
boolean
If true, reduces the conversations_unread counter for the visitor; should be false for replies
markConversationAsUnread(integer $conversationId, integer $userId)
integer
integer
prepareConversation(array $conversation) : array
array
array
prepareConversationConditions(array $conditions, array $fetchOptions) : string
array
List of conditions. --popupMode (boolean) constrains results to unread, or sent within timeframe specified by options->conversationPopupExpiryHours
array
The fetch options that have been provided. May be edited if criteria requires.
string
Criteria as SQL for where clauseprepareConversationFetchOptions(array $fetchOptions)
prepareConversations(array $conversations) : array
array
array
prepareLimitFetchOptions(array $fetchOptions) : array
Includes: limit, offset, page, and perPage.
inherited_from | \XenForo_Model::prepareLimitFetchOptions() |
---|
array
Unprepared options
array
Limit options; keys: limit, offsetprepareMessage(array $message, array $conversation) : array
array
array
array
Prepared messageprepareMessages(array $messages, array $conversation) : array
array
array
array
Prepared messagesprepareStateLimitFromConditions(array $fetchOptions, string $table, string $stateField, string $userField) : string
Looks for keys "deleted" and "moderated".
inherited_from | \XenForo_Model::prepareStateLimitFromConditions() |
---|
array
string
Name of the table to prefix the state and user fields with
string
Name of the field that holds the state
string
Name of the field that holds the user ID
string
SQL condition to limit staterebuildUnreadConversationCountForUser(integer $userId)
integer
resetLocalCacheData($name)
This can be used if you know when some cached data has expired.
inherited_from | \XenForo_Model::resetLocalCacheData() |
---|
setAllowCachedRead($allowCachedRead)
This may be controllable on an individual level basis, if the implementation allows it.
inherited_from | \XenForo_Model::setAllowCachedRead() |
---|
boolean
setLocalCacheData(string $name, $value)
This should only be used if you know what you're doing or for testing purposes!
Note that you cannot get the existing data via the public interface. If you think you need the set data, use a new object. It defaults to empty. :)
inherited_from | \XenForo_Model::setLocalCacheData() |
---|
string
standardizeNodePermissionsAndUserId(integer $nodeId, array | null $permissions, integer | null $userId)
If an invalid permission set or user ID is provided, the current visitor's will be used.
inherited_from | \XenForo_Model::standardizeNodePermissionsAndUserId() |
---|
integer
Node permissions are for
array
null
Permissions for node or null to use current visitor's permissions
integer
null
User permissions belong to or null to use current visitor
standardizePermissionCombinationIdAndUserId(integer | null $permissionCombinationId, integer | null $userId)
If null, users current visitor's values.
inherited_from | \XenForo_Model::standardizePermissionCombinationIdAndUserId() |
---|
integer
null
Permission combination ID or null to use current visitor
integer
null
User permissions belong to or null to use current visitor
standardizePermissionsAndUserId(array | null $permissions, integer | null $userId)
If an invalid permission set or user ID is provided, the current visitor's will be used.
inherited_from | \XenForo_Model::standardizePermissionsAndUserId() |
---|
array
null
Global pPermissions or null to use current visitor's permissions
integer
null
User permissions belong to or null to use current visitor
standardizeViewingUserReference(array $viewingUser)
This array must contain all basic user info (preferably all user info) and include global permissions in a "permissions" key. If not an array or missing a user_id, the visitor's values will be used.
inherited_from | \XenForo_Model::standardizeViewingUserReference() |
---|
array
null
standardizeViewingUserReferenceForNode(integer $nodeId, array $viewingUser, array $nodePermissions)
inherited_from | \XenForo_Model::standardizeViewingUserReferenceForNode() |
---|
integer
array
null
Viewing user; if null, use visitor
array
null
Permissions for this node; if null, use visitor's
unserializePermissionsInList(array $items, string $serializedKey, string $targetKey) : array
inherited_from | \XenForo_Model::unserializePermissionsInList() |
---|
array
List of items
string
Key where serialized permissions are
string
Key where unserialized permissions will go
array
List of items with permissions unserialized_getAttachmentModel() : \XenForo_Model_Attachment.
\XenForo_Model_Attachment.
_getCache(boolean $forceCachedRead) : \Zend_Cache_Core | \Zend_Cache_Frontend | false
If cache reads are disabled, this will return false.
inherited_from | \XenForo_Model::_getCache() |
---|
boolean
If true, the global "allow cached read" value is ignored
\Zend_Cache_Core
\Zend_Cache_Frontend
false
_getDb() : \Zend_Db_Adapter_Abstract
inherited_from | \XenForo_Model::_getDb() |
---|
\Zend_Db_Adapter_Abstract
_getLocalCacheData(string $name) : mixed
inherited_from | \XenForo_Model::_getLocalCacheData() |
---|
string
mixed
_getUsersMatchingCriteria(array $userIds, string $searchString) : array
Used in conjunction with this class's findConversation[x]ForUser() methods.
array
string
array
_updateConversationReadDate(integer $conversationId, integer $userId, integer $newReadDate, \Zend_Db_Adapter_Abstract $db) : integer
integer
integer
integer
\Zend_Db_Adapter_Abstract
integer
$newReadDate$_allowCachedRead : boolean
If not, it should be retrieved from the source.
inherited_from | \XenForo_Model::$$_allowCachedRead |
---|
$_cache : \Zend_Cache_Core | \Zend_Cache_Frontend
inherited_from | \XenForo_Model::$$_cache |
---|
$_db : \Zend_Db_Adapter_Abstract
inherited_from | \XenForo_Model::$$_db |
---|
$_localCacheData : array
This data is generally treated as canonical, even if {$_allowCachedRead} is false.
inherited_from | \XenForo_Model::$$_localCacheData |
---|
$_modelCache : array
inherited_from | \XenForo_Model::$$_modelCache |
---|
FETCH_FIRST_MESSAGE
FETCH_LAST_MESSAGE_AVATAR
FETCH_RECEIVED_BY