MyBB Community Forums

Full Version: [Tutorial] Add Welcome Banner For Guests Only
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2
[Image: guest_banner_mybb.jpg]

Well had a little play and came up with a way to add a welcome banner for guests only. Here is how to do it:

Edit the Main Header Template and remove the </div> marked in RED:

Quote:<div id="container">
<a name="top" id="top"></a>
<div id="header">
<div class="logo"><a href="{$mybb->settings['bburl']}/index.php"><img src="images/red_theme/logo.png" alt="{$mybb->settings['bbname']}" title="{$mybb->settings['bbname']}" /></a></div>
<div class="menu">
<ul>
<li><a href="{$mybb->settings['bburl']}/search.php"><img src="{$mybb->settings['bburl']}/{$theme['imgdir']}/toplinks/search.gif" alt="" title="" />{$lang->toplinks_search}</a></li>
<li><a href="{$mybb->settings['bburl']}/memberlist.php"><img src="{$mybb->settings['bburl']}/{$theme['imgdir']}/toplinks/memberlist.gif" alt="" title="" />{$lang->toplinks_memberlist}</a></li>
<li><a href="{$mybb->settings['bburl']}/calendar.php"><img src="{$mybb->settings['bburl']}/{$theme['imgdir']}/toplinks/calendar.gif" alt="" title="" />{$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="" title="" />{$lang->toplinks_help}</a></li>
</ul>
</div>
<hr class="hidden" />
<div id="panel">
{$welcomeblock}
</div>
</div>
<hr class="hidden" />
<br class="clear" />
<div id="content">
{$pm_notice}
{$bannedwarning}
{$bbclosedwarning}
{$unreadreports}
<navigation>
<br />

Now edit the header_welcomeblock_member Template and add the </div> which is marked in green (basically at the end of the file)

Quote:<span style="float:right;">{$lang->welcome_current_time}</span>
{$lang->welcome_back} (<a href="{$mybb->settings['bburl']}/usercp.php"><strong>{$lang->welcome_usercp}</strong></a>{$modcplink}{$admincplink} &mdash; <a href="{$mybb->settings['bburl']}/member.php?action=logout&amp;logoutkey={$mybb->user['logoutkey']}">{$lang->welcome_logout}</a>)<br />
<span class="links">
<a href="#" onclick="MyBB.popupWindow('{$mybb->settings['bburl']}/misc.php?action=buddypopup', 'buddyList', 350, 350);">{$lang->welcome_open_buddy_list}</a>
</span>
<a href="{$mybb->settings['bburl']}/search.php?action=getnew">{$lang->welcome_newposts}</a> | <a href="{$mybb->settings['bburl']}/search.php?action=getdaily">{$lang->welcome_todaysposts}</a> | <a href="{$mybb->settings['bburl']}/private.php">{$lang->welcome_pms}</a> {$lang->welcome_pms_usage}
</div>

Now edit the header_welcomeblock_guest Template and add the code which is in green to the bottom of the file:

Quote:<script type="text/javascript">
<!--
lang.username = "{$lang->login_username}";
lang.password = "{$lang->login_password}";
lang.login = "{$lang->login}";
lang.lost_password = " &mdash; <a href=\"{$mybb->settings['bburl']}/member.php?action=lostpw\">{$lang->lost_password}<\/a>";
lang.register_url = " &mdash; <a href=\"{$mybb->settings['bburl']}/member.php?action=register\">{$lang->welcome_register}<\/a>";
// -->
</script>
<span style="float: right;">{$lang->welcome_current_time}</span>
<span id="quick_login">{$lang->welcome_guest} (<a href="{$mybb->settings['bburl']}/member.php?action=login" onclick="MyBB.quickLogin(); return false;">{$lang->welcome_login}</a> &mdash; <a href="{$mybb->settings['bburl']}/member.php?action=register">{$lang->welcome_register}</a>)</span>
</div>
<div style="text-align:center; margin-top:15px;">
<a href="member.php?action=register"><img src="images/red_theme/register.jpg" title="Click Here To Register on {$mybb->settings['bbname']}" alt="Click Here To Register"></a>
</div>

Then simply edit the image location in the last bit of code and anything else you want to adjust.

This was done on the standard MyBB theme on MyBB v1.4.8

If you have any problems or suggestions please post below Smile
Awesome tutorial..
Gonna try it Wink
nice idea Wink
Thanks for this Smile
(2009-09-11, 05:39 AM)Mr blue Wrote: [ -> ]Awesome tutorial..
Gonna try it Wink

(2009-09-11, 08:12 PM)FBI Wrote: [ -> ]nice idea Wink

(2009-09-12, 10:50 AM)Chrissyscott Wrote: [ -> ]Thanks for this Smile

No probs guys if you get any problems please let me know Smile
(2009-09-10, 12:38 AM)Chrissy Poo Wrote: [ -> ]Well had a little play and came up with a way to add a welcome banner for guests only. Here is how to do it:
...
...

Thank you for posting this information to help other users.

But i wonder why you have to alter the "/div" in the two first files, it would be so simplier to just add this green portion in the header_welcomeblock_guest Template :

Quote:<script type="text/javascript">
<!--
lang.username = "{$lang->login_username}";
lang.password = "{$lang->login_password}";
lang.login = "{$lang->login}";
lang.lost_password = " &mdash; <a href=\"{$mybb->settings['bburl']}/member.php?action=lostpw\">{$lang->lost_password}<\/a>";
lang.register_url = " &mdash; <a href=\"{$mybb->settings['bburl']}/member.php?action=register\">{$lang->welcome_register}<\/a>";
// -->
</script>
<span style="float: right;">{$lang->welcome_current_time}</span>
<span id="quick_login">{$lang->welcome_guest} (<a href="{$mybb->settings['bburl']}/member.php?action=login" onclick="MyBB.quickLogin(); return false;">{$lang->welcome_login}</a> &mdash; <a href="{$mybb->settings['bburl']}/member.php?action=register">{$lang->welcome_register}</a>)</span>
</div>
<div style="text-align:center; margin-top:15px;">
<a href="member.php?action=register"><img src="images/red_theme/register.jpg" title="Click Here To Register on {$mybb->settings['bbname']}" alt="Click Here To Register"></a>


This way you just have to edit one file. Wink
(2009-09-12, 01:49 PM)exdiogene Wrote: [ -> ]Thank you for posting this information to help other users.

But i wonder why you have to alter the "/div" in the two first files, it would be so simplier to just add this green portion in the header_welcomeblock_guest Template :

I did try this but it then used the background from the header_welcomeblock_guest Template this was no good for styling the box. The way I have done it gives you full control over the banner etc.
(2009-09-12, 01:54 PM)Chrissy Poo Wrote: [ -> ]
(2009-09-12, 01:49 PM)exdiogene Wrote: [ -> ]Thank you for posting this information to help other users.

But i wonder why you have to alter the "/div" in the two first files, it would be so simplier to just add this green portion in the header_welcomeblock_guest Template :

I did try this but it then used the background from the header_welcomeblock_guest Template this was no good for styling the box. The way I have done it gives you full control over the banner etc.

Is it possible that it was only because you forgotten to close the template <div> just before opening your new <div> for your banner?

I have tested my solution with two different themes, including the default, and it is working... Wink
Not sure but anyway either way will work fine Smile
OMG!
I was looking for it! Thanks!
Pages: 1 2