MyBB Community Forums

Full Version: Change template header after login
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2
Hello!

I am wondering if anyone can suggest a way i can change the the header (navigation bar to be exact) so that after a user logs in the different heading in the nav bar change:
Here is an example:

Before the user logs in:
http://gyazo.com/165811dbcc85b1e82592c7002c486bad

and after:
http://gyazo.com/d44246a7c25b50f4b8065a9c7b5f7519

I've had a long look for something to this, but no luck. I have even tried custom templates.

Any help would be appreciated


Thanks
You can manipulate the welcome_block_ templates to do that, seeing the code you already have would make it easier to give guidance, URL?
(2012-04-21, 10:50 PM)Alan Shepperson Wrote: [ -> ]You can manipulate the welcome_block_ templates to do that, seeing the code you already have would make it easier to give guidance, URL?

Ok, if you don't mind i'll get back to tommorow and give it to you then

But thanks anyway Smile
(2012-04-21, 10:50 PM)Alan Shepperson Wrote: [ -> ]You can manipulate the welcome_block_ templates to do that, seeing the code you already have would make it easier to give guidance, URL?

Ok so header code is
<a name="top" id="top"></a>
<navigation>	
		<div id="header">
			<div class="logo"><a href="http://www.zeeworld.org/"><img src="{$theme['logo']}" alt="{$mybb->settings['bbname']}" title="{$mybb->settings['bbname']}" /></a></div>
			<div id="panel">
	{$welcomeblock}
			</div>
<br class="clear"/>
			<hr class="hidden" />
		</div>

			<div class="menu">
				<ul>
					<li class="menutext"><a href="http://www.zeeworld.org/">Home</a></li>
					<li><a href="http://forums.zeeworld.org">Forum Index</a></li>
					<li><a href="/memberlist.php">Members</a></li>
					<li><a href="{$mybb->settings['bburl']}/calendar.php">{$lang->toplinks_calendar}</a></li>
					<li><a href="/member.php?action=login">Profile</a></li>
                                        <li class="float_right"><a href="{$mybb->settings['bburl']}/search.php">{$lang->toplinks_search}</a></li>
				</ul>
			</div>
<div id="container">
		<hr class="hidden" />
		<div id="content">
			{$pm_notice}
			{$bannedwarning}
			{$bbclosedwarning}
			{$unreadreports}
			{$pending_joinrequests}
Hello?
(2012-04-21, 10:50 PM)Alan Shepperson Wrote: [ -> ]URL?
(2012-04-25, 11:46 AM)Alan Shepperson Wrote: [ -> ]
(2012-04-21, 10:50 PM)Alan Shepperson Wrote: [ -> ]URL?

Ok sorry Smile

it is - http://forums.zeeworld.org
I haven't dipped into editing MyBB much files, yet.. But this is what I did to check if the user is logged in or not for a page outside of the forums.

if ($mybb->session->uid == 0) {
  // do something here if they're not logged in
} else {
  // do something here if they are logged in
}

If you're new to PHP and all, and if this works for you. I'm not sure where you'll place this in the forum theme files but to put HTML in the if statement....

<?php if ($mybb->session->uid == 0): ?>
  <p> Import HTML here when they're not logged in </p>
<?php else: ?>
  <p> Import HTML here if they're logged in </p>
 <?php endif; ?>
No luck. Thanks
You can do this the NON plugin way, or the plugin way.

The non plugin way is to have the nav bar inside the welcome blocks. Then the members see the members nav bar, the non members see the guest navbar.

The plug-in way is to get the templates conditional plugin from mybb hacks and then hide links in the nav bar using template conditionals.

<div class="menu">
<ul>
<li><a href="{$mybb->settings['bburl']}/search.php"><img src="{$theme['imgdir']}/toplinks/search.gif" alt="" title="" />{$lang->toplinks_search}</a></li>
<if !in_array($GLOBALS['mybb']->user['usergroup'], array(1,5,7)) then>
<li><a href="{$mybb->settings['bburl']}/memberlist.php"><img src="{$theme['imgdir']}/toplinks/memberlist.gif" alt="" title="" />{$lang->toplinks_memberlist}</a></li>
</if>
<li><a href="{$mybb->settings['bburl']}/calendar.php"><img src="{$theme['imgdir']}/toplinks/calendar.gif" alt="" title="" />{$lang->toplinks_calendar}</a></li>
<li><a href="{$mybb->settings['bburl']}/misc.php?action=help"><img src="{$theme['imgdir']}/toplinks/help.gif" alt="" title="" />{$lang->toplinks_help}</a></li>
</ul>
</div>
Pages: 1 2