How To Change The Redirect For The Login Form

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Jake Bunce
    Senior Member
    • Dec 2000
    • 46598
    • 3.6.x

    How To Change The Redirect For The Login Form

    By default, vBulletin's login forms redirect you back to the page you were viewing. You can define your own redirection URL by adding this hidden field to the login form:

    Code:
    [color=red]<input type="hidden" name="url" value="[color=blue]REDIRECTION URL HERE[/color]" />[/color]
    The login forms are in two main templates:

    Navbar login form
    Go to your:

    Admin CP -> Styles & Templates -> Style Manager -> « » -> Navigation / Breadcrumb Templates -> navbar

    Add the red code. Change the blue redirection URL appropriately:

    Code:
    		<!-- login form -->
    		<form action="login.php" method="post" onsubmit="md5hash(vb_login_password, vb_login_md5password, vb_login_md5password_utf, $show[nopasswordempty])">
    		<script type="text/javascript" src="clientscript/vbulletin_md5.js"></script>
    		<table cellpadding="0" cellspacing="$stylevar[formspacer]" border="0">
    		<tr>
    			<td class="smallfont">$vbphrase[username]</td>
    			<td><input type="text" class="bginput" style="font-size: 11px" name="vb_login_username" id="navbar_username" size="10" accesskey="u" tabindex="101" value="$vbphrase[username]" onfocus="if (this.value == '$vbphrase[username]') this.value = '';" /></td>
    			<td class="smallfont" colspan="2" nowrap="nowrap"><label for="cb_cookieuser_navbar"><input type="checkbox" name="cookieuser" value="1" tabindex="103" id="cb_cookieuser_navbar" accesskey="c" />$vbphrase[remember_me]</label></td>
    		</tr>
    		<tr>
    			<td class="smallfont">$vbphrase[password]</td>
    			<td><input type="password" class="bginput" style="font-size: 11px" name="vb_login_password" size="10" accesskey="p" tabindex="102" /></td>
    			<td><input type="submit" class="button" value="$vbphrase[log_in]" tabindex="104" title="$vbphrase[enter_username_to_login_or_register]" accesskey="s" /></td>
    		</tr>
    		</table>
    		<input type="hidden" name="s" value="$session[sessionhash]" />
    		<input type="hidden" name="do" value="login" />		
    		<input type="hidden" name="vb_login_md5password" />
    		<input type="hidden" name="vb_login_md5password_utf" />
    		[color=red]<input type="hidden" name="url" value="[color=blue]REDIRECTION URL HERE[/color]" />[/color]
    		</form>
    		<!-- / login form -->

    Standard error login form
    Go to your:

    Admin CP -> Styles & Templates -> Style Manager -> « » -> STANDARD_ERROR and STANDARD_ERROR_LITE

    The field is already there. Just replace $scriptpath with your redirection URL:

    Code:
    		<if condition="$show['permission_error']">		
    			<script type="text/javascript" src="clientscript/vbulletin_md5.js"></script>
    			<form action="login.php" method="post" onsubmit="md5hash(vb_login_password, vb_login_md5password, vb_login_md5password_utf, $show[nopasswordempty])">
    			<input type="hidden" name="do" value="login" />
    			<input type="hidden" name="url" value="[color=blue]$scriptpath[/color]" />
    			<input type="hidden" name="vb_login_md5password" />
    			<input type="hidden" name="vb_login_md5password_utf" />
    			$postvars
    	
    			<input type="hidden" name="s" value="$session[sessionhash]" />
    		
    			<!-- permission error message - user not logged in -->
widgetinstance 262 (Related Topics) skipped due to lack of content & hide_module_if_empty option.
Working...