MyBB Community Forums

Full Version: Member links only in the header?
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
How can I make it so in the header, some links only members can see?
Use the header_welcomeblock_member template to display links to members and, similarly, the header_welcomeblock_guest template to display links to guests.

If your layout doesn't allow you to do that, then use the PHP in Templates plugin and use this in your code, whereas 4 is the uid of the usergroup you want to show links to:

<if $GLOBALS['mybb']->user['usergroup'] == 4 then>
Hello world!
</if>
That would work like header template?
I don't quite understand that question. What are you asking exactly?
in the header template you have this.
<ul id="menu">
                        <li><a href="{$mybb->settings['bburl']}/portal.php">Home</a></li>
                         <li><a href="{$mybb->settings['bburl']}/index.php">Forums</a></li>
			<li><a href="{$mybb->settings['bburl']}/search.php">{$lang->toplinks_search}</a></li>
			<li><a href="{$mybb->settings['bburl']}/memberlist.php">{$lang->toplinks_memberlist}</a></li>
			<li><a href="{$mybb->settings['bburl']}/calendar.php">{$lang->toplinks_calendar}</a></li>
			<li><a href="{$mybb->settings['bburl']}/misc.php?action=help">FAQ</a></li>
                        <li><a href="{$mybb->settings['bburl']}/newpoints.php">Store</a></li>
                        <li><a href="{$mybb->settings['bburl']}/helpcenter.php">Help Center</a></li>
                        <li><a href="/contact-us.php">Apply to be a Builder</a></li>
			{$welcomeblock}
	</div>
I want to add another link but so only MEMBERS, ADMINS, AND SUCH can see.
Yeah, you can either edit the header_welcomeblock_member template and add your own links accordingly or use the other solution, which is to use the PHP in Templates plugin.
Would this work?
<if $GLOBALS['mybb']->user['usergroup'] == 2, 4, 6 then>
Hello world!
</if> 
Can't use template conditionals with MyBB.
(2011-06-08, 11:45 PM)Mr. E Wrote: [ -> ]Can't use template conditionals with MyBB.
Yes you can, i do.


(2011-06-08, 11:36 PM)blake Wrote: [ -> ]Would this work?
<if $GLOBALS['mybb']->user['usergroup'] == 2, 4, 6 then>
Hello world!
</if> 

That's incorrect. It should be like this;
<if in_array($GLOBALS['mybb']->user['usergroup'],array(2,4,6)) then>
Hello world!
</if>