The Arcive of Official vBulletin Modifications Site.It is not a VB3 engine, just a parsed copy! |
|
#1
|
|||
|
|||
Login form redirection
Hi,
I dislike the little login form on the forum home page. yes it can be handy, but for my site it's just overkill. So, I've done a little modifying and created an html login page which has the same functionality but allows me to you a log in link on other pages. it works just perfectly however, there's one slight problem ? page redirection. After the user clicks "login" they are taken tot he redirection page and told to hang on while they are logged in. Thenthey are redirected back to the log in form. What I would like to do is redirect them to the home page after log in. Can anyone assist me in changing the redirection? Thanks. Here's the form code as it stands. HTML Code:
<form action="login.php" method="post" onsubmit="md5hash(vb_login_password,vb_login_md5password)"> <script type="text/javascript" src="clientscript/vbulletin_md5.js"></script> <table cellpadding="0" cellspacing="$stylevar[formspacer]" border="0"> <tr><td><br /><br /><br /></td></tr> <tr> <td align="center" class="smallfont" valign="middle">Username</td></tr> <tr><td valign="middle" align="center"><input type="text" class="button" name="vb_login_username" id="navbar_username" size="15" accesskey="u" tabindex="1" value="" onfocus="if (this.value == '$vbphrase[username]') this.value = '';" /></td> </tr> <tr><td><br /></td></tr> <tr> <td class="smallfont" valign="middle" align="center">Password</td></tr> <tr><td valign="middle" align="center"><input type="password" class="button" name="vb_login_password" size="15" accesskey="p" tabindex="2" /></td> </tr> <tr><td><br /></td></tr> <tr> <td class="smallfont" <label for="cb_cookieuser_navbar"><input type="checkbox" name="cookieuser" value="1" tabindex="3" id="cb_cookieuser_navbar" accesskey="c" checked="checked" />Remember Me</label></td></tr><tr> <td align="center"><input type="submit" class="button" value=" Log In " tabindex="4" title="Enter username to login" accesskey="s" /></td> </tr> <tr><td><br /><br /><br /></td></tr> </table> <input type="hidden" name="s" value="$session[sessionhash]" /> <input type="hidden" name="do" value="login" /> <input type="hidden" name="forceredirect" value="1" /> <input type="hidden" name="vb_login_md5password" /> </form> <!-- / login form --> </td> |
#2
|
|||
|
|||
Nvermind I got it working... and now run without that little log in form for guests
|
#3
|
|||
|
|||
That's just what I need now for my page!
I'm curious - how did you fix it? |
#4
|
|||
|
|||
I added a conditional to the template that displays a different message if the user is logged in. Therefore, when a user gets redirected to the same page it simply tells them they have logged in successfully.
I thought about realeasing this as a hack. But it's pretty much the tip created by Gary W. here https://vborg.vbsupport.ru/showthrea...=Powered+pages with my own special template modification. I'm including the internal parts of the template here, minus header and footer content. Remember to check all link paths to be certain they are correct for your forums. I've not coded this for general release. HTML Code:
General page start and header content here (use the general or blank shell templates if needed and just paste the information below between the header and footer.) <table class="tborder" cellpadding="$stylevar[cellpadding]" cellspacing="$stylevar[cellspacing]" border="0" width="30%" align="center"> <tr> <td class="alt2" width="100%" align="center"> <!-- Show to Logged in users --> <if condition="$bbuserinfo['userid']"> <table cellpadding="0" cellspacing="$stylevar[formspacer]" border="0"> <td align="center" class="smallfont" valign="middle"><b>Hi $bbuserinfo[username]!</b><br /> You have been logged in successfully. </td></tr> </table> <!-- /Show to Logged in users --> <else /> <!-- login form --> <form action="/login.php" method="post" onsubmit="md5hash(vb_login_password,vb_login_md5password)"> <script type="text/javascript" src="/clientscript/vbulletin_md5.js"></script> <table cellpadding="0" cellspacing="$stylevar[formspacer]" border="0"> <tr><td><br /></td><td></tr> <tr> <td align="center" class="smallfont" valign="middle">Username</td></tr> <tr><td valign="middle" align="center"><input type="text" class="button" name="vb_login_username" id="navbar_username" size="15" accesskey="u" tabindex="1" value="" onfocus="if (this.value == '$vbphrase[username]') this.value = '';" /></td> </tr> <tr><td><br /></td></tr> <tr> <td class="smallfont" valign="middle" align="center">Password</td></tr> <tr><td valign="middle" align="center"><input type="password" class="button" name="vb_login_password" size="15" accesskey="p" tabindex="2" /></td> </tr> <tr><td><br /></td></tr> <tr> <td class="smallfont" <label for="cb_cookieuser_navbar"><input type="checkbox" name="cookieuser" value="1" tabindex="3" id="cb_cookieuser_navbar" accesskey="c" checked="checked" />Remember Me</label></td></tr><tr> <td align="center"><input type="submit" class="button" value=" Log In " tabindex="4" title="Enter username to login]" accesskey="s" /></td> </tr> <tr><td><br /></td></tr> </table> <input type="hidden" name="s" value="$session[sessionhash]" /> <input type="hidden" name="do" value="login" /> <input type="hidden" name="forceredirect" value="0" /> <input type="hidden" name="vb_login_md5password" /> </form> <!-- / login form --> </td> </tr> </table><br /><br /> </if> </td></tr></table> <br /><br /> General footer and closing content here |
#5
|
|||
|
|||
That's exactly what I did just now with mine! I tried to add a history.back link for logged in users, but that link keeps sending me back to the logged in page.
HTML Code:
<if condition="$bbuserinfo['userid']"> <br /> <center> You are logged in.<br /><a href="#" onclick="history.back(1)" return="false">Click here to go the last page you visited</a> </center> <br /> </if> |
#6
|
|||
|
|||
I added a hidden field to an external login form that sets a variable to the URL of the original referring page. I then added that URL to the list of acceptable global variables. And, finally, tweaked the standard redirect page to use that url IF that variable is set. This way, a user can login anywhere in the site and not get pushed back to the login page, but the actual page where they clicked "login". Make sense?
|
#7
|
|||
|
|||
knary can you post an example of the code? I'd love to do what you're describing rather than just a conditional for page content.
|
|
|
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
More Information | |
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|