__construct()
addFetchOptionJoin()
addInlineModOptionToPost()
addPositionLimit()
alertQuotedMembers()
assertValidCutOffOperator()
canApproveUnapprovePost()
canDeletePost()
canEditPost()
canLikePost()
canMergePost()
canMovePost()
canReportPost()
canUndeletePost()
canViewAttachmentOnPost()
canViewIps()
canViewPost()
canViewPostAndContainer()
canWarnPost()
countVisiblePostsInThread()
create()
deletePost()
fetchAllKeyed()
getAndMergeAttachmentsIntoPosts()
getConditionsForClause()
getContentTypeField()
getContentTypesWithField()
getLastPostInThread()
getModelFromCache()
getNewestPostsInThreadAfterDate()
getNextPostInThread()
getNextPostInThreadByPosition()
getOrderByClause()
getPermissionBasedPostFetchOptions()
getPostById()
getPostIdsInRange()
getPostInsertMessageState()
getPostsAndParentData()
getPostsByIds()
getPostsByUserInOthersThreads()
getPostsInThread()
getPostsInThreadSimple()
getQuoteTextForPost()
isDeleted()
isModerated()
limitQueryResults()
mergePosts()
movePostsToNewThread()
prepareLimitFetchOptions()
preparePost()
preparePostJoinOptions()
prepareStateLimitFromConditions()
recalculatePostPositionsInThread()
resetLocalCacheData()
setAllowCachedRead()
setLocalCacheData()
standardizeNodePermissionsAndUserId()
standardizePermissionCombinationIdAndUserId()
standardizePermissionsAndUserId()
standardizeViewingUserReference()
standardizeViewingUserReferenceForNode()
unserializePermissionsInList()
_getAttachmentModel()
_getCache()
_getDataRegistryModel()
_getDb()
_getLocalCacheData()
_getThreadModel()
_getUserModel()
$_allowCachedRead
$_cache
$_db
$_localCacheData
$_modelCache
FETCH_DELETION_LOG
FETCH_FORUM
FETCH_THREAD
FETCH_USER
FETCH_USER_OPTIONS
FETCH_USER_PROFILE
Model for posts.
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_Post |
---|
__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
addInlineModOptionToPost(array $post, array $thread, array $forum, array $nodePermissions, array $viewingUser) : array
array
Post info
array
Thread the post is in
array
Forum the thread/post 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 neededalertQuotedMembers(array $post)
array
assertValidCutOffOperator(string $operator)
inherited_from | \XenForo_Model::assertValidCutOffOperator() |
---|
string
canApproveUnapprovePost(array $post, array $thread, array $forum, string $errorPhraseKey, array $nodePermissions, array $viewingUser) : boolean
This does not check post viewing permissions.
array
Info about the post
array
Info about the thread this post is in
array
Info about the forum the thread is in
string
Returned phrase key for a specific error
array
null
array
null
boolean
canDeletePost(array $post, array $thread, array $forum, string $deleteType, string $errorPhraseKey, array $nodePermissions, array $viewingUser) : boolean
This does not check post viewing permissions.
array
Info about the post
array
Info about the thread this post is in
array
Info about the forum the thread is in
string
The type of deletion requested (soft or hard)
string
Returned phrase key for a specific error
array
null
array
null
boolean
canEditPost(array $post, array $thread, array $forum, string $errorPhraseKey, array $nodePermissions, array $viewingUser) : boolean
This does not check post viewing permissions.
array
Info about the post
array
Info about the thread this post is in
array
Info about the forum the thread is in
string
Returned phrase key for a specific error
array
null
array
null
boolean
canLikePost(array $post, array $thread, array $forum, string $errorPhraseKey, array $nodePermissions, array $viewingUser) : boolean
This does not check post viewing permissions.
array
Info about the post
array
Info about the thread this post is in
array
Info about the forum the thread is in
string
Returned phrase key for a specific error
array
null
array
null
boolean
canMergePost(array $post, array $thread, array $forum, string $errorPhraseKey, array $nodePermissions, array $viewingUser) : boolean
This does not check post viewing permissions.
array
Info about the post
array
Info about the thread this post is in
array
Info about the forum the thread is in
string
Returned phrase key for a specific error
array
null
array
null
boolean
canMovePost(array $post, array $thread, array $forum, string $errorPhraseKey, array $nodePermissions, array $viewingUser) : boolean
This does not check post viewing permissions.
array
Info about the post
array
Info about the thread this post is in
array
Info about the forum the thread is in
string
Returned phrase key for a specific error
array
null
array
null
boolean
canReportPost(array $post, array $thread, array $forum, boolean $errorPhraseKey, array $nodePermissions, array $viewingUser) : boolean
array
array
array
boolean
string
array
null
array
null
boolean
canUndeletePost(array $post, array $thread, array $forum, string $errorPhraseKey, array $nodePermissions, array $viewingUser) : boolean
This does not check post viewing permissions.
array
Info about the post
array
Info about the thread this post is in
array
Info about the forum the thread is in
string
Returned phrase key for a specific error
array
null
array
null
boolean
canViewAttachmentOnPost(array $post, array $thread, array $forum, string $errorPhraseKey, array $nodePermissions, array $viewingUser) : boolean
This does not check post viewing permissions.
array
Info about the post
array
Info about the thread this post is in
array
Info about the forum the thread is in
string
Returned phrase key for a specific error
array
null
array
null
boolean
canViewIps(array $post, array $thread, array $forum, string $errorPhraseKey, array $nodePermissions, array $viewingUser) : boolean
array
array
array
string
array
null
array
null
boolean
canViewPost(array $post, array $thread, array $forum, string $errorPhraseKey, array $nodePermissions, array $viewingUser) : boolean
This does not check thread/forum viewing permissions fully.
array
Info about the post
array
Info about the thread this post is in
array
Info about the forum the thread is in
string
Returned phrase key for a specific error
array
null
array
null
boolean
canViewPostAndContainer(array $post, array $thread, array $forum, string $errorPhraseKey, array $nodePermissions, array $viewingUser) : boolean
TThis will check that any parent container can be viewed as well.
array
Info about the post
array
Info about the thread this post is in
array
Info about the forum the thread is in
string
Returned phrase key for a specific error
array
null
array
null
boolean
canWarnPost(array $post, array $thread, array $forum, string $errorPhraseKey, array $nodePermissions, array $viewingUser) : boolean
This does not check post viewing permissions.
array
Info about the post
array
Info about the thread this post is in
array
Info about the forum the thread is in
string
Returned phrase key for a specific error
array
null
array
null
boolean
countVisiblePostsInThread(integer $threadId) : integer
This is the reply count + 1.
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
deletePost(integer $postId, string $deleteType, array $options, array $forum) : \XenForo_DataWriter_DiscussionMessage_Post
integer
ID of the post to delete
string
Type of deletion (soft or hard)
array
Deletion options.
array
The forum containing this post
\XenForo_DataWriter_DiscussionMessage_Post
The DW used to delete the postfetchAllKeyed(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
getAndMergeAttachmentsIntoPosts(array $posts) : array
The attachments key will not be set if no attachments are found for the post.
array
array
Posts, with attachments added where necessarygetConditionsForClause(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 valuegetLastPostInThread(integer $threadId, array $fetchOptions) : array | false
integer
array
Collection of options that relate to fetching
array
false
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
getNewestPostsInThreadAfterDate(integer $threadId, integer $postDate, array $fetchOptions) : array
Posts are returned newest first.
integer
integer
array
array
getNextPostInThread(integer $threadId, integer $postDate, array $fetchOptions, array $ignoredUserIds) : array | false
This is useful for finding the first unread post in a thread, for example.
integer
integer
Finds first post posted after this
array
Collection of options that relate to fetching
array
false
getNextPostInThreadByPosition(integer $threadId, integer $position, array $fetchOptions) : array
integer
integer
array
array
getOrderByClause(array $choices, array $fetchOptions, string $defaultOrderSql) : string
inherited_from | \XenForo_Model::getOrderByClause() |
---|
array
array
string
string
Order by clause or empty stringgetPermissionBasedPostFetchOptions(array $thread, array $forum, array $nodePermissions, array $viewingUser) : array
array
Thread the posts will belong to
array
Forum the thread belongs to
array
null
array
null
array
Keys: deleted/moderated (both booleans)getPostById(integer $postId, array $fetchOptions) : array | false
integer
array
false
getPostIdsInRange(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 IDsgetPostInsertMessageState(array $thread, array $forum, array $nodePermissions, array $viewingUser) : string
array
Thread info, may be empty for a new thread
array
array
null
array
null
string
Message state (visible, moderated, deleted)getPostsAndParentData(array $postIds, integer $permissionCombinationId) : array
If a permission combination ID is passed, the forums will retrieve permission info.
array
List of post IDs
integer
Permission combination ID that will be retrieved with the forums.
array
Format: [0] => list of posts, [1] => list of threads, [2] => list of forumsgetPostsByIds(array $postIds, array $fetchOptions) : array
array
array
Collection of options that relate to fetching
array
Format: [post id] => infogetPostsByUserInOthersThreads(integer $userId) : array
integer
array
getPostsInThread(integer $threadId, array $fetchOptions) : array
Fetch options may limit posts returned.
integer
array
Collection of options that relate to fetching
array
getPostsInThreadSimple(integer $threadId, boolean $includeMessage) : array
This does not include the actual contents of a message unless specifically requested.
integer
boolean
If true, includes message contents
array
Format: [post id] => infogetQuoteTextForPost(array $post, integer $maxQuoteDepth) : string
array
integer
Max depth of quoted text (-1 for unlimited)
string
isDeleted(array $post) : boolean
array
boolean
isModerated(array $post) : 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 necessarymergePosts(array $posts, array $threads, integer $targetPostId, string $newMessage, array $options) : boolean
The target post must be in the list of given posts.
array
array
integer
string
array
boolean
movePostsToNewThread(array $posts, array $sourceThreads, array $newThread, array $options) : array | false
The new thread will be created in this function.
array
array
array
Information about the new thread; first/last/poster info filled in automatically
array
Options to control behavior
array
false
New thread ID or falseprepareLimitFetchOptions(array $fetchOptions) : array
Includes: limit, offset, page, and perPage.
inherited_from | \XenForo_Model::prepareLimitFetchOptions() |
---|
array
Unprepared options
array
Limit options; keys: limit, offsetpreparePost(array $post, array $thread, array $forum, array $nodePermissions, array $viewingUser) : array
array
Post to prepare
array
Thread post is in
array
Forum thread/post is in
array
null
array
null
array
Prepared version of postpreparePostJoinOptions(array $fetchOptions) : array
array
containing a 'join' integer key build from this class's FETCH_x bitfields
array
Containing 'selectFields' and 'joinTables' keys. Example: selectFields = ', user.*, foo.title'; joinTables = ' INNER JOIN foo ON (foo.id = other.id) 'prepareStateLimitFromConditions(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 staterecalculatePostPositionsInThread(integer $threadId) : array
integer
array
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_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_DELETION_LOG
FETCH_FORUM
FETCH_THREAD
FETCH_USER
FETCH_USER_OPTIONS
FETCH_USER_PROFILE