MyBB Community Forums

Full Version: redirect to previous page after logging in
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2 3
hi
how to redirect users to page where they were after logging in
i did a lot of search but nothing helped
It does this automatically if you use the quick login form.
its really weird because today i noticed that after logging in a message appears that shows something like:
thank you for logging in
you will now be taken back to where you came from. !!!

so what about this message
i think there is some thing wrong in member.php or member login template
Can you please post your member_login template?
ofcourse thanks for taking time

<html>
<head>
<title>{$mybb->settings['bbname']} - {$lang->login}</title>
{$headerinclude}
</head>
<body>
{$header}
<br />
{$inline_errors}
{$member_loggedin_notice}
<form action="member.php" method="post">
<table border="0" cellspacing="{$theme['borderwidth']}" cellpadding="{$theme['tablespace']}" class="tborder">
<tr>
<td class="thead" colspan="2"><strong>{$lang->login}</strong></td>
</tr>
<tr>
<td class="trow1"><strong>{$lang->username}</strong></td>
<td class="trow1"><input type="text" class="textbox" name="username" size="25" maxlength="{$mybb->settings['maxnamelength']}" style="width: 200px;" value="{$username}" /></td>
</tr>
<tr>
<td class="trow2"><strong>{$lang->password}</strong><br /><span class="smalltext">{$lang->pw_note}</span></td>
<td class="trow2"><input type="password" class="textbox" name="password" size="25" style="width: 200px;" value="{$password}" /> (<a href="member.php?action=lostpw">{$lang->lostpw_note}</a>)</td>
</tr>
<tr>
<td class="trow1" colspan="2" align="center"><label title="{$lang->remember_me_desc}"><input type="checkbox" class="checkbox" name="remember" checked="checked" value="yes" /> {$lang->remember_me}</label></td>
</tr>
{$captcha}
</table>
<br />
<div align="center"><input type="submit" class="button" name="submit" value="{$lang->login}" /></div>
<input type="hidden" name="action" value="do_login" />
<input type="hidden" name="url" value="{$redirect_url}" />
</form>
{$footer}
</body>
</html>
The line that does the redirection is:

<input type="hidden" name="url" value="{$redirect_url}" />

That is there and looks right, I am not sure why it isn't working. Try this:

Go to Admin CP -> Configuration -> General Configuration -> Disable All Plugins -> Yes

Now log out, go to a forum post and try logging in. If it works, a plugin is causing the problem.

Hope this helps! Smile.
Nope!
didn't work!
Hmm, can you please give me the link to your forum, and private message me a demo account? I could then investigate further. Smile.
sorry but my domian expired,and im trying renew it ASAP , im changing some stuff in my forum on localhost
also i should say i did some changes in member.php in:
line 1092 for logging in and 1193 for logging out

			// Redirect to the URL if it is not member.php
			redirect(htmlentities($mybb->input['url']), $lang->redirect_loggedin);
		}
		else
		{
			redirect("portal.php", $lang->redirect_loggedin);
		}

i changed index.php to portal.php

is it cause of problem?
any other suggestions?
Sorry, had to go for a bit.

You can try uploading a fresh member.php and see if that fixes. Just rename your current member.php to like member_old.php.
Pages: 1 2 3