News:

Want to get involved in developing SMF, then why not lend a hand on our github!

Main Menu

Disabling boards post and topics count

Started by fsharp, December 01, 2020, 01:02:24 PM

Previous topic - Next topic

fsharp

How can I disable boards number of posts and topics count.
My forum is showing o posts and 0 topics as shown in the image attached to this post.

shadav

you'll need to edit the theme files to remove it

it's showing 0 as there are no topics in that board...once there are then it will display the correct numbers, if the numbers are not correct then you need to reset your forums counts
in your admin under maintenance > Recount all forum totals and statistics

but if you do not wish to display the counts at all, back up first just in case you decide to change your mind later....

*searches may vary depending on themes, just search for something similar*

in your theme's BoardIndex.template.php

find
// Show some basic information about the number of posts, etc.
echo '
</td>
<td class="stats windowbg">
<p>', comma_format($board['posts']), ' ', $board['is_redirect'] ? $txt['redirects'] : $txt['posts'], ' <br />
', $board['is_redirect'] ? '' : comma_format($board['topics']) . ' ' . $txt['board_topics'], '
</p>
</td>

replace with
echo '
</td>


for the message index
in MessageIndex.template.php

to remove the sort option
find and remove
<th scope="col" width="14%"><a href="', $scripturl, '?board=', $context['current_board'], '.', $context['start'], ';sort=replies', $context['sort_by'] == 'replies' && $context['sort_direction'] == 'up' ? ';desc' : '', '">', $txt['replies'], $context['sort_by'] == 'replies' ? ' <img src="' . $settings['images_url'] . '/sort_' . $context['sort_direction'] . '.gif" alt="" />' : '', '</a> / <a href="', $scripturl, '?board=', $context['current_board'], '.', $context['start'], ';sort=views', $context['sort_by'] == 'views' && $context['sort_direction'] == 'up' ? ';desc' : '', '">', $txt['views'], $context['sort_by'] == 'views' ? ' <img src="' . $settings['images_url'] . '/sort_' . $context['sort_direction'] . '.gif" alt="" />' : '', '</a></th>

to remove the replies/views
find
</td>
<td class="stats ', $color_class, '">
', $topic['replies'], ' ', $txt['replies'], '
<br />
', $topic['views'], ' ', $txt['views'], '
</td>
<td class="lastpost ', $alternate_class, '">


replace with
</td>
<td class="lastpost ', $alternate_class, '">


for the recent topics/posts
in Recent.template.php

to remove the sort option
find and remove
<th scope="col" width="14%" align="center" class="hidden">
<a href="', $scripturl, '?action=unread', $context['showing_all_topics'] ? ';all' : '', $context['querystring_board_limits'], ';sort=replies', $context['sort_by'] == 'replies' && $context['sort_direction'] == 'up' ? ';desc' : '', '">', $txt['replies'], $context['sort_by'] == 'replies' ? ' <img src="' . $settings['images_url'] . '/sort_' . $context['sort_direction'] . '.gif" alt="" />' : '', '</a>
</th>


to remove the replies/views
find and remove
<td class="', $color_class, ' stats windowbg">
', $topic['replies'], ' ', $txt['replies'], '
<br />
', $topic['views'], ' ', $txt['views'], '
</td>

fsharp

Quote from: shadav on December 01, 2020, 01:27:42 PM
you'll need to edit the theme files to remove it

it's showing 0 as there are no topics in that board...once there are then it will display the correct numbers, if the numbers are not correct then you need to reset your forums counts
in your admin under maintenance > Recount all forum totals and statistics

but if you do not wish to display the counts at all, back up first just in case you decide to change your mind later....

*searches may vary depending on themes, just search for something similar*

in your theme's BoardIndex.template.php

find
// Show some basic information about the number of posts, etc.
echo '
</td>
<td class="stats windowbg">
<p>', comma_format($board['posts']), ' ', $board['is_redirect'] ? $txt['redirects'] : $txt['posts'], ' <br />
', $board['is_redirect'] ? '' : comma_format($board['topics']) . ' ' . $txt['board_topics'], '
</p>
</td>

replace with
echo '
</td>


for the message index
in MessageIndex.template.php

to remove the sort option
find and remove
<th scope="col" width="14%"><a href="', $scripturl, '?board=', $context['current_board'], '.', $context['start'], ';sort=replies', $context['sort_by'] == 'replies' && $context['sort_direction'] == 'up' ? ';desc' : '', '">', $txt['replies'], $context['sort_by'] == 'replies' ? ' <img src="' . $settings['images_url'] . '/sort_' . $context['sort_direction'] . '.gif" alt="" />' : '', '</a> / <a href="', $scripturl, '?board=', $context['current_board'], '.', $context['start'], ';sort=views', $context['sort_by'] == 'views' && $context['sort_direction'] == 'up' ? ';desc' : '', '">', $txt['views'], $context['sort_by'] == 'views' ? ' <img src="' . $settings['images_url'] . '/sort_' . $context['sort_direction'] . '.gif" alt="" />' : '', '</a></th>

to remove the replies/views
find
</td>
<td class="stats ', $color_class, '">
', $topic['replies'], ' ', $txt['replies'], '
<br />
', $topic['views'], ' ', $txt['views'], '
</td>
<td class="lastpost ', $alternate_class, '">


replace with
</td>
<td class="lastpost ', $alternate_class, '">


for the recent topics/posts
in Recent.template.php

to remove the sort option
find and remove
<th scope="col" width="14%" align="center" class="hidden">
<a href="', $scripturl, '?action=unread', $context['showing_all_topics'] ? ';all' : '', $context['querystring_board_limits'], ';sort=replies', $context['sort_by'] == 'replies' && $context['sort_direction'] == 'up' ? ';desc' : '', '">', $txt['replies'], $context['sort_by'] == 'replies' ? ' <img src="' . $settings['images_url'] . '/sort_' . $context['sort_direction'] . '.gif" alt="" />' : '', '</a>
</th>


to remove the replies/views
find and remove
<td class="', $color_class, ' stats windowbg">
', $topic['replies'], ' ', $txt['replies'], '
<br />
', $topic['views'], ' ', $txt['views'], '
</td>


It worked. The topics and post counts is disabled. Good job.

Aleksi "Lex" Kilpinen

Slava
Ukraini!
"Before you allow people access to your forum, especially in an administrative position, you must be aware that that person can seriously damage your forum. Therefore, you should only allow people that you trust, implicitly, to have such access." -Douglas

How you can help SMF

Advertisement: