tenants
Well-known member
I want to get the permissions (added to the development Permission Definitions) of the thread creator (rather than the visitingUser).
I'm doing this within a Template_Hook
For this, can I use
and then
I ask this, since getPermissionCombinationByUserId quries a table and returns the permisions from a column labeled "cache_value" possibly meaning that they wont always be upto date. When is the cache_value updated?
Usually, for the viewing user you can just use something like this:
but for the thread creator, we don't have cached user values (obviously, since having this for each thread would completely bloat the application)
Is there a better way of doing this, or should I use the above 1st method mentioned to get the thread creators permissions?
I'm doing this within a Template_Hook
For this, can I use
Code:
$threadCreatorPerms= XenForo_Model::create('XenForo_Model_Permission')->getPermissionCombinationByUserId($threadCreatorUserId);
Code:
$perms['somePerm'] = (XenForo_Permission::hasPermission(XenForo_Permission::unserializePermissions($threadCreatorPerms['cache_value']), 'myMod', 'somePerm') ? true : false);
I ask this, since getPermissionCombinationByUserId quries a table and returns the permisions from a column labeled "cache_value" possibly meaning that they wont always be upto date. When is the cache_value updated?
Usually, for the viewing user you can just use something like this:
Code:
class MyMod_Model_Perms extends XenForo_Model
{
public function getPermissions(array $viewingUser = null)
{
$this->standardizeViewingUserReference($viewingUser);
$perms['somePerm'] = (XenForo_Permission::hasPermission($viewingUser['permissions'], 'myMod', 'somePerm') ? true : false);
return $perms;
}
}
but for the thread creator, we don't have cached user values (obviously, since having this for each thread would completely bloat the application)
Is there a better way of doing this, or should I use the above 1st method mentioned to get the thread creators permissions?