MyBB Community Forums

Full Version: Hide when unavailable?
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
I know that you can make certain sections of the site unavailable to specific groups, such as making the memberlist and calendar unavailable to regular members. However, a regular member, while logged in, can still see the link at the top for the unavailable items.

I'd rather them not even know the areas exist if they aren't going to be available to them. How would I go about hiding items to those groups who can't access them?
*bump*

This is the only thing stopping me from using this forum. Anyone have any ideas?
I don't have any ideas.

Does it really matter tho? I mean, if it's set so they can't see it, they're only going to get a no permission page. Wink
I have replied to you on the Mods forums, anyway i will provide the info here also.

----------------------------------

There is a way by combining HTML and PHP however it needs abit of handy work.

Go to Admin CP > Templates > Modify / Delete > Global Templates / Add template

Make the title top_links

and the content as follows
<div class="menu">
				<ul>
					<li><a href="{$mybb->settings['bburl']}/search.php"><img src="{$mybb->settings['bburl']}/{$theme['imgdir']}/toplinks/search.gif" alt="" />{$lang->toplinks_search}</a></li>
					<li><a href="{$mybb->settings['bburl']}/memberlist.php"><img src="{$mybb->settings['bburl']}/{$theme['imgdir']}/toplinks/memberlist.gif" alt="" />{$lang->toplinks_memberlist}</a></li>
					<li><a href="{$mybb->settings['bburl']}/calendar.php"><img src="{$mybb->settings['bburl']}/{$theme['imgdir']}/toplinks/calendar.gif" alt="" />{$lang->toplinks_calendar}</a></li>
					<li><a href="{$mybb->settings['bburl']}/misc.php?action=help"><img src="{$mybb->settings['bburl']}/{$theme['imgdir']}/toplinks/help.gif" alt="" />{$lang->toplinks_help}</a></li>
				</ul>
			</div>

This same code can be found in the header template, so replace it in the header template with
{$top_links}

Now open global.php

Find

eval("\$header = \"".$templates->get("header")."\";");
Above it add
if($mybb->user['usergroup'] == 4)//Allowed groups
{
	eval("\$top_links = \"".$templates->get("top_links")."\";");
}

Note that when we say

$mybb->user['usergroup']

It means the group of the user who is browsing the site, therefore in this if statment include only those who have permissions to see the links, for example


if($mybb->user['usergroup'] == 4 || $mybb->user['usergroup'] == 3)//Allowed groups
{
	eval("\$top_links = \"".$templates->get("top_links")."\";");
}
This way it works for both admins and super mods. You can add additional groups, you only need the group id.