Fixed forum not behaving as expected while logged out.
This commit is contained in:
parent
a48d583f33
commit
ac1ca16291
2 changed files with 5 additions and 4 deletions
|
@ -17,7 +17,7 @@ switch ($indexMode) {
|
|||
|
||||
default:
|
||||
$categories = forum_get_root_categories(user_session_current('user_id', 0));
|
||||
$blankForum = count($categories) <= 1 && $categories[0]['forum_children'] < 1;
|
||||
$blankForum = count($categories) < 1;
|
||||
|
||||
foreach ($categories as $key => $category) {
|
||||
$categories[$key]['forum_subforums'] = forum_get_children(
|
||||
|
|
|
@ -9,7 +9,7 @@ function forum_perms_get_user(?int $forum, int $user): array
|
|||
{
|
||||
$perms = perms_get_blank(MSZ_FORUM_PERM_MODES);
|
||||
|
||||
if ($user < 1 || $forum < 0) {
|
||||
if ($user < 0 || $forum < 0) {
|
||||
return $perms;
|
||||
}
|
||||
|
||||
|
@ -33,7 +33,8 @@ function forum_perms_get_user(?int $forum, int $user): array
|
|||
FROM `msz_forum_permissions`
|
||||
WHERE (`forum_id` = :forum_id OR `forum_id` IS NULL)
|
||||
AND (
|
||||
(`user_id` = :user_id_1 AND `role_id` IS NULL)
|
||||
(`user_id` IS NULL AND `role_id` IS NULL)
|
||||
OR (`user_id` = :user_id_1 AND `role_id` IS NULL)
|
||||
OR (
|
||||
`user_id` IS NULL
|
||||
AND `role_id` IN (
|
||||
|
@ -161,5 +162,5 @@ function forum_perms_get_role_raw(?int $forum, ?int $role): array
|
|||
|
||||
function forum_perms_check_user(string $prefix, ?int $forumId, ?int $userId, int $perm): bool
|
||||
{
|
||||
return $userId > 0 && perms_check(forum_perms_get_user($forumId, $userId)[$prefix] ?? 0, $perm);
|
||||
return perms_check(forum_perms_get_user($forumId, $userId)[$prefix] ?? 0, $perm);
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue