MyBB Community Forums

Full Version: Login form on custom sidebox.
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Please move to the Development section, I accidentaly posted this in the wrong section.

I've recently found out about the sidebox plugin. I was unable to use it, since I have a custom theme. I managed to make a custom sidebox, with basic coding.

I'm trying to get a login box to appear on one of the sideboxes. I've tried using the code from the header_welcomeblock_guest template.
This worked, and I was able to login. Yet, when I was logged in, I kept seeing the login form.

My question:
Is there a way to make that script auto-determine wheter someone is a guest, or logged in? I assume it is used on the forums, but I have no idea where. It would be nice to hide the login form once someone is logged in, and appear a 'welcome' message or some kind.

<a href="{$mybb->settings['bburl']}/member.php?action=register"><strong>Register</strong></a>

<form action="{$mybb->settings['bburl']}/member.php" class="loginform float_right" method="post">
		<input type="hidden" name="action" value="do_login" />
		<input type="hidden" name="url" value="{$url}" />
<label for="username">Username:</label>
		<input type="text" name="username" class="textuser" value="Username" onfocus="if(this.value !== '') { this.value=''; }" onblur="if(this.value == '') { this.value='Username'; }" />
<label for="password">Password:</label>
		<input type="password" class="textpass" name="password" value="Password" onfocus="if(this.value !== '') { this.value=''; }" onblur="if(this.value == '') { this.value='Password'; }" />
		<input type="submit" class="loginsub" value="Login" tabindex="3" />
		<input type="checkbox" value="yes" checked="checked" title="" name="remember" style="display:none;" class="checkbox" />
	</form>

I'm sorry that this mis-shaped the forum, I thought sharing the code will help some people understand my question better.
Using the PHP in Templates plugin you could do the following:

<if $mybb->usergroup['gid'] == 1 then>
// Display login form to guests
<else />
// Do nothing
</if>