How to disable all regular user to view 'user area'? (General)

by johnh, Tuesday, September 10, 2013, 08:22 (3880 days ago)

I would like to stop all regular user to view 'user area'. That means the 'user area' data should be viewed by admin & moderator only. Could you tell how to change the scripts? Thanks!

Avatar

How to disable all regular user to view 'user area'?

by Auge ⌂, Wednesday, September 11, 2013, 12:22 (3879 days ago) @ johnh

Hello

I would like to stop all regular user to view 'user area'. That means the 'user area' data should be viewed by admin & moderator only. Could you tell how to change the scripts? Thanks!

Search for themes/[your_theme]/main.tpl (if you use the default theme, see [1]) and inside the file for <ul id="usermenu">. It's line 53 in the default theme.

That's the code. I putted every item of the menu list into a single line, in the file itself all items are in one code line.

<ul id="usermenu">
{if $user}<li><a href="index.php?mode=user&amp;action=edit_profile" title="{#profile_link_title#}"><strong>{$user}</strong></a></li>
<li><a href="index.php?mode=user" title="{#user_area_link_title#}">{#user_area_link#}</a></li>
{if $admin}<li><a href="index.php?mode=admin" title="{#admin_area_link_title#}">{#admin_area_link#}</a></li>{/if}
<!-- and so on -->

Put the line <li><a href="index.php?mode=user" title="{#user_area_link_title#}">{#user_area_link#}</a></li> into the {if $admin}-block like below.

<ul id="usermenu">
{if $user}<li><a href="index.php?mode=user&amp;action=edit_profile" title="{#profile_link_title#}"><strong>{$user}</strong></a></li>
{if $admin}<li><a href="index.php?mode=user" title="{#user_area_link_title#}">{#user_area_link#}</a></li>
<li><a href="index.php?mode=admin" title="{#admin_area_link_title#}">{#admin_area_link#}</a></li>{/if}
<!-- and so on -->

Now the user area is only accessible for admins (but not for a moderator!).

[1] To keep the change in case of an update it would be the best to copy the default theme and change the copy. You can select your theme in the admin area afterwards.

Tschö, Auge

--
Trenne niemals Müll, denn er hat nur eine Silbe!

How to disable all regular user to view 'user area'?

by johnh, Friday, September 20, 2013, 05:27 (3871 days ago) @ Auge

I tried your hack, however this is not enough. What I really worried is the link below:
http://mylittleforum.net/forum/index.php?mode=user

That is OK if a user want to check an individual user's detail (probably they want to communicate to each other). But I don't like a user can see the list of all other users.

1) How to change so that only admin and moderator can see the list?

2) Is it possible so that the user can chose not to display the details?

Thanks!

RSS Feed of thread