Avatar

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

by Auge ⌂, Wednesday, September 11, 2013, 12:22 (3874 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!


Complete thread:

 RSS Feed of thread