Mouth
Well-known member
When setting/reviewing user group permission for Unregistered / Unconfirmed (group id: 1), many permission available are invalid and unable to be used for guests. XF exits many functions if $viewingUser['user_id'] is not set, thus regardless of whether an allowed permission is set for that functionality to the Unregistered / Unconfirmed user group, it is ignored anyway.
For example, XenForo/Model/Post.php ...
User group permission for /admin.php?user-groups/unregistered-unconfirmed.1/edit should either;
1. Not display or be available to set at all if it is invalid for guest users
2. Highlight (to the right of the Not Set | Allow | Never columns?) that the permission requires a logged in user.
For example, XenForo/Model/Post.php ...
Code:
/**
* Determines if the post can be liked with the given permissions.
* This does not check post viewing permissions.
*
* @param array $post Info about the post
* @param array $thread Info about the thread this post is in
* @param array $forum Info about the forum the thread is in
* @param string $errorPhraseKey Returned phrase key for a specific error
* @param array|null $nodePermissions
* @param array|null $viewingUser
*
* @return boolean
*/
public function canLikePost(array $post, array $thread, array $forum, &$errorPhraseKey = '', array $nodePermissions = null, array $viewingUser = null)
{
$this->standardizeViewingUserReferenceForNode($thread['node_id'], $viewingUser, $nodePermissions);
if (!$viewingUser['user_id'])
{
return false;
}
if ($post['message_state'] != 'visible')
{
return false;
}
if ($post['user_id'] == $viewingUser['user_id'])
{
$errorPhraseKey = 'liking_own_content_cheating';
return false;
}
return XenForo_Permission::hasContentPermission($nodePermissions, 'like');
}
User group permission for /admin.php?user-groups/unregistered-unconfirmed.1/edit should either;
1. Not display or be available to set at all if it is invalid for guest users
2. Highlight (to the right of the Not Set | Allow | Never columns?) that the permission requires a logged in user.