Nulumia
Well-known member
Seems like this one is right under the nose but couldn't find anything exact.
I'm wondering if there's an in-built function to check whether a content (thread, post, resource) is visible to guests, while logged as another usergroup, or neutrally checking without using \XF::visitor. So canView() wouldn't be applicable.
The following works:
However this involves getting the container entity, not as elegant.
Thanks for ideas.
I'm wondering if there's an in-built function to check whether a content (thread, post, resource) is visible to guests, while logged as another usergroup, or neutrally checking without using \XF::visitor. So canView() wouldn't be applicable.
The following works:
Code:
$guestPermissionSet = \XF::permissionCache()->getPermissionSet(\XF\Repository\User::$guestPermissionCombinationId);
return $guestPermissionSet->hasContentPermission('node', $node->node_id, 'view');
However this involves getting the container entity, not as elegant.
Thanks for ideas.