MyBB Community Forums

Full Version: [Tip&Trick]Message for your guests
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
This modification will allow you to show a message to your guests, which will be displayed at the top of the forum. Hopefully this will encourage them to register.

To have an idea how the mod looks like in action, please check the screenshots attached at the end of this topic Smile

First of all you must have the PHP in Templates and Template Conditionals plug in installed:

http://community.mybboard.net/thread-31860.html

After you install that plug in, go to the Acp of your forum-Templates & Style-Templates-Default Templates-Header Templates-header.

Replace the whole code in there with the following:

<if $GLOBALS['mybb']->user['usergroup'] == 1 then> 
<table border="0" cellspacing="{$theme['borderwidth']}" cellpadding="{$theme['tablespace']}" class="tborder">
<thead>
<tr>
<td class="thead">
<div style="margin:0 auto;text-align:center"><strong>Welcome to our community Guest!</strong></div>
</td>
</tr>
</thead>
<tr>
		<td class="trow1"align="center">
<strong>Please consider <a href="member.php?action=register">Registering</a> to gain full access!Registration is free and it only takes a few moments to complete<br />
Already a member? <a href="member.php?action=login">Login then</a></strong></td>
</tr>
</table>
</if>	

<div id="container">
		<a name="top" id="top"></a>
		<div id="header">
			<div class="logo"><a href="{$mybb->settings['bburl']}/index.php"><img src="{$theme['logo']}" 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 />

Or you can display it under the menu bar:

<div id="container">
		<a name="top" id="top"></a>
		<div id="header">
			<div class="logo"><a href="{$mybb->settings['bburl']}/index.php"><img src="{$theme['logo']}" 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>
<br /><br /><if $GLOBALS['mybb']->user['usergroup'] == 1 then> 
<table border="0" cellspacing="{$theme['borderwidth']}" cellpadding="{$theme['tablespace']}" class="tborder">
<thead>
<tr>
<td class="thead">
<div style="margin:0 auto;text-align:center"><strong>Welcome to our community Guest!</strong></div>
</td>
</tr>
</thead>
<tr>
		<td class="trow1"align="center">
<strong>Please consider <a href="member.php?action=register">Registering</a> to gain full access!Registration is free and it only takes a few moments to complete<br />
Already a member? <a href="member.php?action=login">Login then</a></strong></td>
</tr>
</table>
</if>	
		</div>
		<hr class="hidden" />
		<br class="clear" />
		<div id="content">
			{$pm_notice}
			{$bannedwarning}
			{$bbclosedwarning}
			{$unreadreports}
			<navigation>
			<br />
Though its good idea to use the php code within the templates, But fortunately we have more then two plugin right now for such kind of things, one from nickman and the pother from wanum box ...
nice Tip Smile
php conditionals by Yumi it´s amazing

if you accept suggestions:
make a tutorial to hide "Reply" and "New Thread" buttons to users without that permission
or even closed threads Smile
(2009-06-06, 07:21 AM)ghazal Wrote: [ -> ]Though its good idea to use the php code within the templates, But fortunately we have more then two plugin right now for such kind of things, one from nickman and the pother from wanum box ...

This uses a different coding. Actually, I created this for someone who converted from a x forum to mybb and was using some of my mods that I had created for that x forum. He asked me to convert those mods to mybb and I did and then thought to post them here as well to share with everyone.

(2009-06-06, 12:31 PM)aglioeolio Wrote: [ -> ]nice Tip Smile
php conditionals by Yumi it´s amazing

if you accept suggestions:
make a tutorial to hide "Reply" and "New Thread" buttons to users without that permission
or even closed threads Smile

Indeed, that php conditionals by Yumi it´s a very useful plug in.

About those other tutorials, atm I don''t have so much free time but later on when I start a forum with mybb and if no one else in meanwhile has done so, then I will see what I can do.
You're correct Babjusi.
Nice trick

Yumi plugins is nice.
No hook, and could minimize from uninstalling many plugins during update/upgrade MyBB.
Only one single (Zinga) plugin. For me, its easier to save (export) backup Template (theme) instead of screwing install/uninstall plugin Wink

I use it here