Topic: How to disable showing user list in frontend?

Hello,

as I don’t think it is a good idea to show a user list to everyone, I’d like to disable it in frontend. Even if you delete the entry users from the menu, someone could guess this URL and take a look at the list. Worst of all, the email addresses are shown, though obfuscated in source, but this should not be a problem for today’s spam bots.

I could change the files plugins/box/users/views/frontend/index.view.php and plugins/box/users/views/frontend/profile.view.php, but perhaps they would be overwritten on next system update. So my question is: Is there a way to override core functionalities without overwriting the core files? For example, like in WordPress, with the help of functions.php? Or similar to Drupal, concrete5 etc.?

An option in the backend to disable the display of the user list would also be great.

Any hints for a workaround are welcome, thank you.
Torsten

Re: How to disable showing user list in frontend?

Hi Torsten-K!

No there is not! You have to change plugins/box/users/views/frontend/index.view.php and place some code, for example:

<?php
header('Location: http://yourwebsite.com');
exit();
// exit();
?>

This way users are redirected to another address that you want, this php code its very simple and secure!

I sure hope this will help you! wink

Best regards!

http://monstracreative.com - themes, plugins and snippets for monstra cms

:: ATTENTION ::
Need help? Login at your account at: http://monstracreative.com/users/login. -> You have a excellent support center at our website! wink

Re: How to disable showing user list in frontend?

@wormsunited
Very short code indeed, thank you for your help!

Re: How to disable showing user list in frontend?

@torsten-k

You welcome! Anytime wink

http://monstracreative.com - themes, plugins and snippets for monstra cms

:: ATTENTION ::
Need help? Login at your account at: http://monstracreative.com/users/login. -> You have a excellent support center at our website! wink

5 (edited by nakome 2015-01-26 13:33:34)

Re: How to disable showing user list in frontend?

Try this:

Note: you  can use with

<?php Chunk::get('functions');?> 
<?php
        // file functions.chunk.php
       // Add this in index.template.php or in header.chunk.php
      // if go to users login show echo 
       if (Uri::segment(0) == 'users' && Uri::segment(1) == 'login'){ 
              echo 'This is login page'; 
      // if  go to users  redirect
       }else if (Uri::segment(0) == 'users'){ 
               Request::redirect(Option::get('siteurl'));
      }
?>
..::: Moncho Varela ::::..   ..::: @Nakome ::::..   ..::: Github ::::..

Re: How to disable showing user list in frontend?

@nakome
Wow, thank you, this works like a charm.

7 (edited by nakome 2015-01-30 03:41:48)

Re: How to disable showing user list in frontend?

Functions like Wordpress it's possible, You can use Json for custom data, functions for contact files and more but i you need use  $vars  or functions  use include or require_once not chuck becaouse chunk is used by minify you probably get error.

With this code you write last access for admin in log.txt in root

    
    // redirect in users page 
    if (Uri::segment(0) == 'users' && Uri::segment(1) == 'login'){ 
     // custom code here
    }else if (Uri::segment(0) == 'users'){ 
        // if admin
        if (Session::exists('user_role') && in_array(Session::get('user_role'), array('admin'))) {
            // write last session in log.txt
            $session = Date('d-m-y').'  User  '.Session::get('user_role').' with Name '.Session::get('user_login').' has login ';
            File::setContent(ROOT.DS.'log.txt',$session); 
        }else{
            Request::redirect(Option::get('siteurl'));
        }
    }
..::: Moncho Varela ::::..   ..::: @Nakome ::::..   ..::: Github ::::..