__construct()
addFetchOptionJoin()
addInlineModOptionToThread()
addPositionLimit()
assertValidCutOffOperator()
canAlterThreadState()
canApproveUnapproveThread()
canDeleteThread()
canEditPoll()
canEditThread()
canEditThreadTitle()
canLockUnlockThread()
canMergeThread()
canMoveThread()
canQuickReply()
canReplyToThread()
canStickUnstickThread()
canUndeleteThread()
canViewAttachmentsInThread()
canViewDeletedPosts()
canViewIps()
canViewModeratedPosts()
canViewThread()
canViewThreadAndContainer()
canVoteOnPoll()
canWatchThread()
countThreads()
countThreadsInForum()
create()
deleteThread()
fetchAllKeyed()
getConditionsForClause()
getContentTypeField()
getContentTypesWithField()
getEarliestThreadDate()
getLastPageNumbers()
getLastUpdatedThreadInForum()
getMaxThreadReadDate()
getModelFromCache()
getNodeIdsFromThreads()
getOrderByClause()
getPermissionBasedThreadFetchConditions()
getStickyThreadsInForum()
getThreadById()
getThreadIdsInRange()
getThreadWatchStateFromThread()
getThreads()
getThreadsAndParentData()
getThreadsByIds()
getThreadsInForum()
getUnreadThreadIds()
getUserThreadReadDate()
hasPreview()
isDeleted()
isModerated()
isNew()
isRedirect()
isVisible()
limitQueryResults()
logThreadView()
markThreadRead()
mergeThreads()
modifyThreadUserPostCount()
prepareLimitFetchOptions()
prepareStateLimitFromConditions()
prepareThread()
prepareThreadConditions()
prepareThreadFetchOptions()
rebuildThreadUserPostCounters()
replaceThreadUserPostCounters()
resetLocalCacheData()
setAllowCachedRead()
setLocalCacheData()
standardizeNodePermissionsAndUserId()
standardizePermissionCombinationIdAndUserId()
standardizePermissionsAndUserId()
standardizeViewingUserReference()
standardizeViewingUserReferenceForNode()
unserializePermissionsInList()
updateThreadViews()
_getCache()
_getDataRegistryModel()
_getDb()
_getForumModel()
_getLocalCacheData()
_getPostModel()
$_allowCachedRead
$_cache
$_db
$_localCacheData
$_modelCache
FETCH_AVATAR
FETCH_DELETION_LOG
FETCH_FIRSTPOST
FETCH_FORUM
FETCH_FORUM_OPTIONS
FETCH_USER
Model for threads.
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_Thread |
---|
__construct()
Use create() statically unless you know what you're doing.
inherited_from | \XenForo_Model::__construct() |
---|
addFetchOptionJoin(array $fetchOptions, integer $join)
Join should be one of the constants.
inherited_from | \XenForo_Model::addFetchOptionJoin() |
---|
array
integer
addInlineModOptionToThread(array $thread, array $forum, array $nodePermissions, array $viewingUser) : array
array
Thread info
array
Forum the thread is in
array
null
array
null
array
List of allowed inline mod actions, format: [action] => trueaddPositionLimit(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 neededassertValidCutOffOperator(string $operator)
inherited_from | \XenForo_Model::assertValidCutOffOperator() |
---|
string
canAlterThreadState(array $thread, array $forum, string $state, string $errorPhraseKey, array $nodePermissions, array $viewingUser) : boolean
This does not check thread viewing permissions.
array
array
string
(intended new discussion_state)
string
array
null
array
null
boolean
canApproveUnapproveThread(array $thread, array $forum, string $errorPhraseKey, array $nodePermissions, array $viewingUser) : boolean
This does not check thread viewing permissions.
array
array
string
array
null
array
null
boolean
canDeleteThread(array $thread, array $forum, $deleteType, string $errorPhraseKey, array $nodePermissions, array $viewingUser) : boolean
This does not check viewing permissions.
array
array
string
array
null
array
null
boolean
canEditPoll(array $thread, array $forum, string $errorPhraseKey, array $nodePermissions, array $viewingUser) : boolean
This does not check thread viewing permissions.
array
array
string
array
null
array
null
boolean
canEditThread(array $thread, array $forum, string $errorPhraseKey, array $nodePermissions, array $viewingUser) : boolean
This does not check thread viewing permissions.
array
Info about the thread
array
Info about the forum the thread is in
string
Returned phrase key for a specific error
array
null
array
null
boolean
canEditThreadTitle(array $thread, array $forum, string $errorPhraseKey, array $nodePermissions, array $viewingUser) : boolean
This does not check thread viewing permissions.
array
Info about the thread
array
Info about the forum the thread is in
string
Returned phrase key for a specific error
array
null
array
null
boolean
canLockUnlockThread(array $thread, array $forum, string $errorPhraseKey, array $nodePermissions, array $viewingUser) : boolean
This does not check viewing permissions.
array
array
string
array
null
array
null
boolean
canMergeThread(array $thread, array $forum, string $errorPhraseKey, array $nodePermissions, array $viewingUser) : boolean
This does not check thread viewing permissions.
array
array
string
array
null
array
null
boolean
canMoveThread(array $thread, array $forum, string $errorPhraseKey, array $nodePermissions, array $viewingUser) : boolean
This does not check thread viewing permissions.
array
array
string
array
null
array
null
boolean
canQuickReply(array $thread, array $forum, string $errorPhraseKey, array $nodePermissions) : boolean
Note that this always assumes the visitor!
array
array
string
array
null
boolean
canReplyToThread(array $thread, array $forum, string $errorPhraseKey, array $nodePermissions, array $viewingUser) : boolean
This does not check viewing permissions.
array
array
string
Returned phrase key for a specific error
array
null
array
null
boolean
canStickUnstickThread(array $thread, array $forum, string $errorPhraseKey, array $nodePermissions, array $viewingUser) : boolean
This does not check viewing permissions.
array
array
string
array
null
array
null
boolean
canUndeleteThread(array $thread, array $forum, string $errorPhraseKey, array $nodePermissions, array $viewingUser) : boolean
This does not check thread viewing permissions.
array
array
string
array
null
array
null
boolean
canViewAttachmentsInThread(array $thread, array $forum, string $errorPhraseKey, array $nodePermissions, array $viewingUser) : boolean
array
array
string
array
array
boolean
canViewDeletedPosts(array $thread, array $forum, string $errorPhraseKey, array $nodePermissions, array $viewingUser) : boolean
array
array
string
array
array
boolean
canViewIps(array $thread, array $forum, string $errorPhraseKey, array $nodePermissions, array $viewingUser) : boolean
array
array
string
array
null
array
null
boolean
canViewModeratedPosts(array $thread, array $forum, string $errorPhraseKey, array $nodePermissions, array $viewingUser) : boolean
array
array
string
array
array
boolean
canViewThread(array $thread, array $forum, string $errorPhraseKey, array $nodePermissions, array $viewingUser) : boolean
This does not check forum viewing permissions.
array
Info about the thread
array
Info about the forum the thread is in
string
Returned phrase key for a specific error
array
null
array
null
boolean
canViewThreadAndContainer(array $thread, array $forum, string $errorPhraseKey, array $nodePermissions, array $viewingUser) : boolean
This will check that any parent container can be viewed as well.
array
Info about the thread
array
Info about the forum the thread is in
string
Returned phrase key for a specific error
array
null
array
null
boolean
canVoteOnPoll(array $thread, array $forum, string $errorPhraseKey, array $nodePermissions, array $viewingUser) : boolean
This does not check if the user has already voted on the poll.
array
array
string
array
null
array
null
boolean
canWatchThread(array $thread, array $forum, string $errorPhraseKey, array $nodePermissions, array $viewingUser) : boolean
This does not check thread viewing permissions.
array
array
string
array
null
array
null
boolean
countThreads(array $conditions) : integer
array
Conditions to apply to the fetching
integer
countThreadsInForum(integer $forumId, array $conditions) : integer
integer
array
Conditions to apply to the fetching
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
deleteThread(integer $threadId, string $deleteType, array $options) : \XenForo_DataWriter_Discussion_Thread
integer
ID of the thread to delete
string
Type of deletion (soft or hard)
array
Deletion options. Currently unused.
\XenForo_DataWriter_Discussion_Thread
The DW used to delete the threadfetchAllKeyed(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
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 valuegetEarliestThreadDate() : integer
integer
getLastPageNumbers(integer $replyCount) : array | boolean
integer
array
boolean
getLastUpdatedThreadInForum(integer $forumId, array $fetchOptions) : array | false
Doesn't include redirects.
integer
array
Collection of options that relate to fetching
array
false
getMaxThreadReadDate(array $thread, array $forum) : integer
array
array
integer
Read timestamp (may be 0)getModelFromCache(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
getNodeIdsFromThreads(array $threads) : array
array
array
getOrderByClause(array $choices, array $fetchOptions, string $defaultOrderSql) : string
inherited_from | \XenForo_Model::getOrderByClause() |
---|
array
array
string
string
Order by clause or empty stringgetPermissionBasedThreadFetchConditions(array $forum, array $nodePermissions, array $viewingUser) : array
array
Forum the threads will belong to
array
null
array
null
array
Keys: deleted (boolean), moderated (boolean or integer, if can only view single user's)getStickyThreadsInForum(integer $forumId, array $conditions, array $fetchOptions) : array
integer
array
Collection of options that relate to fetching
array
Format: [thread id] => infogetThreadById(integer $threadId, array $fetchOptions) : array | false
integer
array
Collection of options related to fetching
array
false
getThreadIdsInRange(integer $start, integer $limit) : array
The IDs returned will be those immediately after the "start" value (not including the start), up to the specified limit.
integer
IDs greater than this will be returned
integer
Number of posts to return
array
List of IDsgetThreadWatchStateFromThread(array $thread, boolean $useDefaultIfNotWatching, array $viewingUser) : string
array
boolean
array
string
getThreads(array $conditions, array $fetchOptions) : array
array
Conditions to apply to the fetching
array
Collection of options that relate to fetching
array
Format: [thread id] => infogetThreadsAndParentData(array $threadIds, integer $permissionCombinationId) : array
If a permission combination ID is passed, the forums will retrieve permission info.
array
List of thread Ids
integer
Permission combination ID that will be retrieved with the forums, into nodePermissions.
array
Format: [0] => list of threads, [1] => list of forumsgetThreadsByIds(array $threadIds, array $fetchOptions) : array
array
array
Collection of options related to fetching
array
Format: [thread id] => infogetThreadsInForum(integer $forumId, array $conditions, array $fetchOptions) : array
integer
array
Conditions to apply to the fetching
array
Collection of options that relate to fetching
array
Format: [thread id] => infogetUnreadThreadIds(integer $userId, array $fetchOptions) : array
Doesn't not work for guests. Doesn't include deleted.
integer
array
Fetching options; limit only
array
List of thread IDsgetUserThreadReadDate(integer $userId, integer $threadId) : integer | null
integer
integer
integer
null
Null if guest; timestamp otherwisehasPreview(array $thread, array $forum, array $nodePermissions, array $viewingUser) : boolean
array
(expects first_post_id and discussion_type indeces)
array
array
null
array
null
boolean
isDeleted(array $thread) : boolean
array
boolean
isModerated(array $thread) : boolean
array
boolean
isNew(array $thread, array $forum) : boolean
array
(expects thread_read_date or forum_read_date, discussion_type and last_post_date indeces)
boolean
isRedirect(array $thread) : boolean
array
boolean
isVisible(array $thread) : boolean
array
boolean
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 necessarylogThreadView(integer $threadId)
integer
markThreadRead(array $thread, array $forum, integer $readDate, array $viewingUser) : boolean
Thread must have thread_read_date key. (Forum should have forum_read_date key.)
array
Thread info
array
Forum info
integer
Timestamp to mark
array
null
boolean
True if marked as readmergeThreads(array $threads, integer $targetThreadId, array $options) : boolean | array
array
integer
array
boolean
array
False if failure, otherwise thread array of merged threadmodifyThreadUserPostCount(integer $threadId, integer $userId, integer $modifyValue)
integer
integer
integer
How to modify the count (eg, 1 or -1)
prepareLimitFetchOptions(array $fetchOptions) : array
Includes: limit, offset, page, and perPage.
inherited_from | \XenForo_Model::prepareLimitFetchOptions() |
---|
array
Unprepared options
array
Limit options; keys: limit, offsetprepareStateLimitFromConditions(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 stateprepareThread(array $thread, array $forum, array $nodePermissions, array $viewingUser) : array
array
Thread to prepare
array
Forum thread is in
array
null
array
null
array
Prepared version of threadprepareThreadConditions(array $conditions, array $fetchOptions) : string
array
List of conditions
array
Modifiable set of fetch options (may have joins pushed on to it)
string
SQL clause (at least 1=1)prepareThreadFetchOptions(array $fetchOptions) : array
array
containing a 'join' integer key build from this class's FETCH_x bitfields
array
Containing selectFields, joinTables, orderClause keys. Example: selectFields = ', user.*, foo.title'; joinTables = ' INNER JOIN foo ON (foo.id = other.id) '; orderClause = ORDER BY x.yrebuildThreadUserPostCounters(integer $threadId, integer | null $userId)
If a user ID is specified, the counters are only updated for that user.
integer
integer
null
replaceThreadUserPostCounters(integer $threadId, array $counters, integer | null $userId)
Old post count records are removed. If a user ID is not null, only that user's post count record is removed, so the array is must only contain records for that user.
integer
array
[user id] => post count
integer
null
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 unserializedupdateThreadViews()
_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
$_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_AVATAR
FETCH_DELETION_LOG
FETCH_FIRSTPOST
FETCH_FORUM
FETCH_FORUM_OPTIONS
FETCH_USER : integer: integer: integer: integer: integer