Restrict statistics access to admins and moderators

This commit is contained in:
Antoine Le Gonidec 2024-07-30 12:22:59 +02:00
parent 33e1780e89
commit 143decc3bb
Signed by: vv221
GPG key ID: 636B78F91CEB80D8
3 changed files with 27 additions and 0 deletions

View file

@ -323,6 +323,13 @@ function template_info_center()
if (empty($context['info_center']))
return;
// Do not display the info center if the user is not a moderator or an admin.
if (
! $context['user']['is_admin'] &&
! $context['user']['is_mod']
)
return;
// Here's where the "Info Center" starts...
echo '
<div class="roundframe" id="info_center">

View file

@ -17,6 +17,16 @@ function template_main()
{
global $context, $settings, $txt, $scripturl, $modSettings;
// Only admins and moderators are allowed to see the forum statistics.
if (
! $context['user']['is_admin'] &&
! $context['user']['is_mod']
) {
echo '
<p><strong>Vous nêtes pas autorisé à accéder aux statistiques du forum.</strong></p>';
return;
}
echo '
<div id="statistics" class="main_section">
<div class="cat_bar">

View file

@ -17,6 +17,16 @@ function template_main()
{
global $context, $settings, $scripturl, $txt;
// Only admins and moderators are allowed to see the list of online members.
if (
! $context['user']['is_admin'] &&
! $context['user']['is_mod']
) {
echo '
<p><strong>Vous nêtes pas autorisé à accéder à la liste des membres actuellement en ligne.</strong></p>';
return;
}
// Display the table header and linktree.
echo '
<div class="main_section" id="whos_online">