__construct()
addContentTitlesToModerators()
addFetchOptionJoin()
addPositionLimit()
assertValidCutOffOperator()
countModerators()
create()
fetchAllKeyed()
getAllGeneralModerators()
getConditionsForClause()
getContentModerator()
getContentModeratorByContentAndUserId()
getContentModeratorById()
getContentModeratorHandlers()
getContentModerators()
getContentModeratorsByUserId()
getContentTypeField()
getContentTypesWithField()
getExtraUserGroupOptions()
getFullPermissionSet()
getGeneralModeratorByUserId()
getGeneralModeratorInterfaceGroupIds()
getGeneralModeratorPermissions()
getModelFromCache()
getModeratorInterfaceGroupIds()
getModeratorPermissions()
getModeratorPermissionsForInterface()
getModeratorPermissionsForUpdate()
getOrderByClause()
insertOrUpdateContentModerator()
insertOrUpdateGeneralModerator()
limitQueryResults()
mergeGeneralModeratorPermissions()
mergeModeratorPermissions()
prepareContentModeratorConditions()
prepareContentModeratorFetchOptions()
prepareLimitFetchOptions()
prepareStateLimitFromConditions()
resetLocalCacheData()
setAllowCachedRead()
setLocalCacheData()
standardizeNodePermissionsAndUserId()
standardizePermissionCombinationIdAndUserId()
standardizePermissionsAndUserId()
standardizeViewingUserReference()
standardizeViewingUserReferenceForNode()
unserializePermissionsInList()
_getCache()
_getDataRegistryModel()
_getDb()
_getLocalCacheData()
_getPermissionModel()
$_allowCachedRead
$_cache
$_db
$_localCacheData
$_modelCache
Model for moderators.
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_Moderator |
---|
__construct()
Use create() statically unless you know what you're doing.
inherited_from | \XenForo_Model::__construct() |
---|
addContentTitlesToModerators(array $moderators) : array
Items that are not returned by the handler will not have a "title" key.
array
array
Moderators with "title" key where givenaddFetchOptionJoin(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 neededassertValidCutOffOperator(string $operator)
inherited_from | \XenForo_Model::assertValidCutOffOperator() |
---|
string
countModerators() : 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
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
getAllGeneralModerators(boolean | null $isSuperModerator) : array
boolean
null
If not null, limits to super or non-super mods only
array
Format: [user id] => infogetConditionsForClause(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
getContentModerator(array $conditions, array $fetchOptions) : array | false
array
array
array
false
getContentModeratorByContentAndUserId(string $contentType, integer $contentId, integer $userId) : array | false
string
integer
integer
array
false
getContentModeratorById(integer $id) : array | false
integer
array
false
getContentModeratorHandlers(string | array | null $limitContentType) : \XenForo_ModeratorHandler_Abstract | array | false
string
array
null
If specified, gets handler for specified type(s) only
getContentModerators(array $conditions, array $fetchOptions) : array
array
array
array
Format: [moderator id] => infogetContentModeratorsByUserId(integer $userId) : array
integer
array
Format: [moderator id] => infogetContentTypeField(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 valuegetExtraUserGroupOptions(string | array $extraGroupIds) : array
string
array
List of existing extra group IDs; may be serialized.
array
List of user group options (keys: label, value, selected)getFullPermissionSet(mixed $value) : array
Useful for automatically populating super moderator records with a full permission set.
mixed
Value for every permission
array
$permissionSet[$groupId][$permId] = $value;getGeneralModeratorByUserId(integer $userId) : array | false
integer
array
false
getGeneralModeratorInterfaceGroupIds() : array
array
getGeneralModeratorPermissions() : array
array
Format: [group id][permission id] => permission infogetModelFromCache(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
getModeratorInterfaceGroupIds(array $moderator) : array
If a content moderator, only includes general and that content's groups; if a super moderator, includes all matching groups; otherwise, includes only the general groups.
array
array
List of interface group IDsgetModeratorPermissions(array $interfaceGroupIds) : array
array
array
Format: [group id][permission id] => permission infogetModeratorPermissionsForInterface(array $interfaceGroupIds, array $existingPermissions) : array
array
List of interface groups to pull permissions from
array
Existing permissions ([group id][permission id]), for selected values
array
List of interface groups, with "permissions" key (flat array)getModeratorPermissionsForUpdate(array | string $newPermissions, array | string $existingPermissions, string $allowValue) : array
array
string
Set of new permissions (ie, new effective value). May be serialized.
array
string
Set of old permissions (ie, old effective value). May be serialized.
string
If a permission is to be allowed, the name of the allow state (allow or content_allow).
array
New effective permissions, with non-matching old values returned to "unset" stategetOrderByClause(array $choices, array $fetchOptions, string $defaultOrderSql) : string
inherited_from | \XenForo_Model::getOrderByClause() |
---|
array
array
string
string
Order by clause or empty stringinsertOrUpdateContentModerator(integer $userId, string $contentType, integer $contentId, array $modPerms, array $extra) : integer
integer
string
integer
array
List of moderator permissions to apply to this content
array
Extra info. Includes general_moderator_permissions and extra_user_group_ids
integer
Moderator IDinsertOrUpdateGeneralModerator(integer $userId, array $modPerms, boolean | null $isSuperModerator, array $extra) : integer
integer
array
General moderator permissions. Does not include content-specific super mod perms.
boolean
null
If non-null, the new super moderator setting
array
Extra data, including extra_user_group_ids and super_moderator_permissions
integer
Moderator IDlimitQueryResults(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 necessarymergeGeneralModeratorPermissions(array $modPerms, array $merge) : array
The initial set may contain more than general moderator permissions.
array
Existing permissions like [group][permission] => info
array
Merging permissions like [group][permission] => info
array
Merged setmergeModeratorPermissions(array $modPerms, array $merge) : array
array
Existing permissions like [group][permission] => info
array
Merging permissions like [group][permission] => info
array
Merged setprepareContentModeratorConditions(array $conditions, array $fetchOptions) : string
array
array
string
SQL clause value for conditionsprepareContentModeratorFetchOptions(array $fetchOptions) : array
array
array
Keys: selectFields, joinTables, orderClauseprepareLimitFetchOptions(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 stateresetLocalCacheData($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 |
---|