MyBB Community Forums

Full Version: Show some text to only guests.
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2
Hi
I am again here and want some help from this lovely community

Actually i want to add some text + links at a place in my template, but want that only guests are able to see it.

Will somebody help in doing this?
You can use the PHP in Templates plugin for this.
actually i am newbie in php i just want the if else statement that can be used to do this like

if (user = guest)
{
text or link
}

i am giving you just an example what i want to do i don`t know the exact condition.
You need to install the plugin anyways. By default, MyBB doesn't allow arbitrary PHP code or conditionals in the templates. Install it and use something like this in your code:

<if $GLOBALS['mybb']->user['usergroup'] == 1 then>
// Example
</if>

(this isn't actual PHP code by the way)
It didn`t worked Sad

i also installed the plugin you said but it don`t worked

i want to put some links in header but it is shown to all and i want that it should be shown only to guests. Is that, that hard to do.
Try this;
<if $mybb->user['uid'] == "0" then>
// Do something here
</if>
Thanks for the help Yaldaram but it also diapered for guests.

maybe i should give you more details.

I want to put some header link in header in sweatdreams theme were it is in a list

this is the code of that area and now i want to hide that register link from members.

<div id="container">
<div style="height: 45px; background: url({$theme['imgdir']}/bar1.png) top left repeat-x; width: 100%; border-bottom: #505050; font-family: arial; font-size: 13px; color: #939393;"><ul id="nav">
<li><a href="{$mybb->settings['bburl']}">Home</a></li>
<li><a href="{$mybb->settings['bburl']}/index.php">Forum</a></li>
<li><a href="{$mybb->settings['bburl']}/member.php?action=register ">Register</a></li>
<li><a href="{$mybb->settings['bburl']}/memberlist.php">Member List</a></li>
</ul></div>
^ I do not understand how you got register link directly on the header !!
<li><a href="{$mybb->settings['bburl']}/member.php?action=register ">Register</a></li>

delete above code from header ... AND your forum URL please ...
(2011-08-08, 05:20 AM)ranjani Wrote: [ -> ]^ I do not understand how you got register link directly on the header !!
<li><a href="{$mybb->settings['bburl']}/member.php?action=register ">Register</a></li>

delete above code from header ... AND your forum URL please ...

As i said i am using Sweat Dreams theme it don`t have any register link so i put one in the navigation area in header.

Is there any problem if i put that link in header?
^ you need login / register links at the header_welcomeblock_guest template (under header templates)

<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>
Pages: 1 2