MyBB Community Forums

Full Version: adding quick login at the top
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
i'm trying to customize the default template of mybb and i can't get to show the quick login form at the top,

i tried to use {$loginform} in header_welcomeblock_guest but it doesnt work,

i even tried to use the login form but it didn't appear.

can anyone help me? Smile
ozaidum Wrote:i'm trying to customize the default template of mybb and i can't get to show the quick login form at the top,

i tried to use {$loginform} in header_welcomeblock_guest but it doesnt work,

i even tried to use the login form but it didn't appear.

can anyone help me? Smile

It used to work that way, but apparently from what I've read here, it doesn't work that way anymore... And also from experience, not all VARS are accessible by ALL templates. Sad

Which is not so bad really... The other option is to add a "eval" statement to the index.php file.. Then that creates problems with upgrades etc... Really not the way to go. Just mod the template.. Smile

In the Index Template:

FIND:

{header} 

AFTER ADD:

<br /><br />
<form action="member.php" method="post">
	<input type="hidden" name="action" value="do_login" />
	<span class="smalltext"><strong>{$lang->quick_login}</strong></span>
	<input type="text" class="textbox" name="username" title="{$lang->login_username}" value="{$lang->login_username}" onfocus="if(this.value == '{$lang->login_username}') { this.value=''; }" onblur="if(this.value=='') { this.value='{$lang->login_username}'; }" />
	<input type="password" class="textbox" name="password" title="{$lang->login_password}" value="{$lang->login_password}" onfocus="if(this.value == '{$lang->login_password}') { this.value=''; }" onblur="if(this.value=='') { this.value='{$lang->login_password}'; }" />
	{$gobutton}
</form>

<br />
<br />
Or put it any other place that you want to.. Smile

If you want to centre it use:

<div align="center" etc.

"THE SCRIPT"

</div ..etc.

If you want to "decorate" it.. You will need to add <table etc, and <class strings etc.....

Have fun! Smile
thanks but...

it works when placed after {header} but when i tried to insert it header_welcomeblock_guest, it doesnt work...

what's the prob?
This works for login etc, in the guest template, but the language vars are not recognised.. Niether was the {gobutton}.

I'll give you the changes, but you're going to have to do a lot more to get it to work with the $lang vars.. Unless you fudge it and simply add the words directly into the code.

<br />
<br />
<form action="member.php" method="post">
<input type="hidden" name="action" value="do_login" />
<span class="smalltext"><strong>{$lang->quick_login}</strong></span>
<input type="text" class="textbox" name="username" title="{$lang->login_username}" value="{$lang->login_username}" onfocus="if(this.value == '{$lang->login_username}') { this.value=''; }" onblur="if(this.value=='') { this.value='{$lang->login_username}'; }" />
<input type="password" class="textbox" name="password" title="{$lang->login_password}" value="{$lang->login_password}" onfocus="if(this.value == '{$lang->login_password}') { this.value=''; }" onblur="if(this.value=='') { this.value='{$lang->login_password}'; }" />&nbsp;&nbsp;<input type="submit" class="button" name="loginsubmit" value="{$lang->login}" />
</form>
<br />
<br />
Open global.lang.php

Find:

?>

BEFORE Add:

/*Quick Login Box*/
$l['quick_login'] = "Quick Login:";
$l['login_username'] = "Username";
$l['login_password'] = "Password";

That will fix your problems... Smile

You can also remove the <br />'s from the top and the bottom of that code also. Wink
ooohhh thank you very much! Smile
You're welcome.... Wink