Use proper ability functions in forum.php.
This commit is contained in:
parent
3d5674dac8
commit
670d672807
2 changed files with 14 additions and 7 deletions
|
@ -32,19 +32,26 @@ if ($forum['forum_type'] == MSZ_FORUM_TYPE_LINK) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
$topics = forum_may_have_topics($forum['forum_type'])
|
$forumMayHaveTopics = forum_may_have_topics($forum['forum_type']);
|
||||||
|
$topics = $forumMayHaveTopics
|
||||||
? forum_topic_listing($forum['forum_id'], user_session_current('user_id', 0), $topicsOffset, $topicsRange)
|
? forum_topic_listing($forum['forum_id'], user_session_current('user_id', 0), $topicsOffset, $topicsRange)
|
||||||
: [];
|
: [];
|
||||||
|
|
||||||
$forum['forum_subforums'] = forum_get_children($forum['forum_id'], user_session_current('user_id', 0));
|
$forumMayHaveChildren = forum_may_have_children($forum['forum_type']);
|
||||||
|
|
||||||
foreach ($forum['forum_subforums'] as $skey => $subforum) {
|
if ($forumMayHaveChildren) {
|
||||||
$forum['forum_subforums'][$skey]['forum_subforums']
|
$forum['forum_subforums'] = forum_get_children($forum['forum_id'], user_session_current('user_id', 0));
|
||||||
= forum_get_children($subforum['forum_id'], user_session_current('user_id', 0), true);
|
|
||||||
|
foreach ($forum['forum_subforums'] as $skey => $subforum) {
|
||||||
|
$forum['forum_subforums'][$skey]['forum_subforums']
|
||||||
|
= forum_get_children($subforum['forum_id'], user_session_current('user_id', 0), true);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
echo tpl_render('forum.forum', [
|
echo tpl_render('forum.forum', [
|
||||||
'forum_breadcrumbs' => forum_get_breadcrumbs($forum['forum_id']),
|
'forum_breadcrumbs' => forum_get_breadcrumbs($forum['forum_id']),
|
||||||
|
'forum_may_have_topics' => $forumMayHaveTopics,
|
||||||
|
'forum_may_have_children' => $forumMayHaveChildren,
|
||||||
'forum_info' => $forum,
|
'forum_info' => $forum,
|
||||||
'forum_topics' => $topics,
|
'forum_topics' => $topics,
|
||||||
'forum_offset' => $topicsOffset,
|
'forum_offset' => $topicsOffset,
|
||||||
|
|
|
@ -12,11 +12,11 @@
|
||||||
<div style="{{ forum_info.forum_colour|html_colour('--accent-colour') }}">
|
<div style="{{ forum_info.forum_colour|html_colour('--accent-colour') }}">
|
||||||
{{ forum_header(forum_info.forum_name, forum_breadcrumbs, true) }}
|
{{ forum_header(forum_info.forum_name, forum_breadcrumbs, true) }}
|
||||||
|
|
||||||
{% if forum_info.forum_subforums|length > 0 or forum_info.forum_type == 1 %}
|
{% if forum_may_have_children and forum_info.forum_subforums|length > 0 %}
|
||||||
{{ forum_category_listing(forum_info.forum_subforums, 'Forums') }}
|
{{ forum_category_listing(forum_info.forum_subforums, 'Forums') }}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
{% if forum_info.forum_type == 0 %}
|
{% if forum_may_have_topics %}
|
||||||
{% set fcbuttons = current_user is defined ? forum_category_buttons(forum_info, forum_perms) : '' %}
|
{% set fcbuttons = current_user is defined ? forum_category_buttons(forum_info, forum_perms) : '' %}
|
||||||
{% set fcpagination = pagination(
|
{% set fcpagination = pagination(
|
||||||
forum_info.forum_topic_count,
|
forum_info.forum_topic_count,
|
||||||
|
|
Loading…
Add table
Reference in a new issue