Topic: User list for logged-in users only

Greetings All,

I'm new to Monstra. I was able to find and edit the index.view.php file located in:  root/plugins/box/users/views/frontend/
A simple fix prevents Non-logged in individuals from seeing the list of users -- substitute the below code or adapt as needed.

I would still like to disable the "Users" menu item (if not logged-in), but I'm not sure how to do that yet!

<table>
    <tr>
        <td></td>
    </tr>
    <?php 
    if (Session::exists('user_role')) { // you must be logged in
    foreach ($users as $user) { ?>
    <tr>
        <td>
            <a href="<?php echo Site::url(); ?>/users/<?php echo $user['id']; ?>"><?php echo $user['login']; ?></a>
        </td>
    </tr>
    <?php }
     } else { echo "You must be logged in to view this page!"; }
      ?>
</table>

Re: User list for logged-in users only

<table>
    <tr>
        <td></td>
    </tr>
    <?php 
    if ( if (Session::get('user_id')) ) { // you must be logged in
    foreach ($users as $user) { ?>
    <tr>
        <td>
            <a href="<?php echo Site::url(); ?>/users/<?php echo $user['id']; ?>"><?php echo $user['login']; ?></a>
        </td>
    </tr>
    <?php }
     } else {
              echo "You must be logged in to view this page!" . Html::nbsp(2); 
?>
             <a href="<?php echo Site::url(); ?>/users/login"><?php echo __('Log In', 'users'); ?></a>
<?php
     }
      ?>
</table>

Re: User list for logged-in users only

It would be better if there was an opportunity to switch off the user listing completely. Even if the menu entry does not exist, the user profiles can still be shown to anyone, just by typing /users after the URL. And because the emails are shown, this could be a rich source for spammers. The email addresses are masked in the source code, but nevertheless Emails of users should never be shown to the public.

Re: User list for logged-in users only

Torsten-K wrote:

It would be better if there was an opportunity to switch off the user listing completely. Even if the menu entry does not exist, the user profiles can still be shown to anyone, just by typing /users after the URL. And because the emails are shown, this could be a rich source for spammers. The email addresses are masked in the source code, but nevertheless Emails of users should never be shown to the public.

@Hi Torsten-K
go plugins/box/users/views/frontend/profile.view.php

line 6 remove <?php if ($user['email'] !== '') { ?><tr><td><b><?php echo __('Email', 'users'); ?></b>:</td><td><?php echo Html::email(Html::toText($user['email'])); ?></td></tr><?php } ?>
wink

Here you will find templates for monstra and morfy xxwebplus
Proposals to create a new template for monstra and morfy tell me your proposals xxwebplus

xxwebplus's Website

Re: User list for logged-in users only

Thank you, xxwebplus, that did the trick!