Getting users permissions/checking if a user can view a forum.

Renari

Member
I don't see this being done anywhere, I made a page and dumped all the variables available to it however outside of the session data having the user id I've found nothing.
 
Well you can use a conditional to check if a user in the usergroup which can view a forum.
<xen:if is="{xen:helper ismemberof, $visitor, x}">
Replace X with the User group ID.
 
No idea, sorry.
EDIT: It may be possible using the database, using the same if condition. But to be honest, not sure how.
 
Code example from the forum controller:

XenForo_ControllerPublic_Forum

Rich (BB code):
		if ($forumIds)
		{
			/* @var $forumModel XenForo_Model_Forum */
			$forumModel = XenForo_Model::create('XenForo_Model_Forum');

			$visitor = XenForo_Visitor::getInstance();
			$permissionCombinationId = $visitor['permission_combination_id'];

			$forums = $forumModel->getForumsByIds($forumIds, array(
				'permissionCombinationId' => $permissionCombinationId
			));
			foreach ($forums AS $forum)
			{
				$visitor->setNodePermissions($forum['node_id'], $forum['node_permission_cache']);
				if ($forumModel->canViewForum($forum))
				{
					$forumData[$forum['node_id']] = array(
						'title' => $forum['title'],
						'url' => XenForo_Link::buildPublicLink('forums', $forum)
					);
				}
			}
		}
 
Top Bottom