MyBB Community Forums

Full Version: redirect to previous page after login
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hi,

first of all I want to say, that myBB is really cool and lightweight and I am really looking forward to the language support! (any plans when it could be finished?) Big Grin

I am planning to use it as forum and also as basis for the user management on my site.

It works great so far as I don't need many complicated permission levels but only check if the user is logged in and if he may post or do admin stuff.

But one thing that would come handy for me and probalby also for many others would be, if myBB would redirect the user after the login to the page he came from. (probably with a check if the url contains a 'http://' to ensure that no personal firewall blocks the referrer)

Then the users are sent back to the thread du to that they decided to login ( ;-) ) or (in my case) to the other page where they have clicked on login.

Another thing I have found is that you write inherit in two words at the page where you can override the settings for a forum. and this looks better as one word ;-)

Thank you very much for this great BB and all the time you have spent with it!

regards,
Philip
sorry, I have two more things... don't want to be nerving ;-)

What would also be good is an option to (de)activate the calendar and the agreement part.

regards,
Philip
I think that you can deactive the calender on a per-usergroup basis. (Can view Calender..).

I would like to see the redirects be a little more friendly too, though. It would make it easier if you are going to reply to a thread but forgot to log on first - you wouldn't have to log on and then go looking for the thread again. [If it already does this, then again, I feel misinformed!]
Oh yes, great, thank you. I have not found that option.

probably I'll start thinking about an redirect feature and then contribute it if its good...

regards,
Philip
oh, to my great suprise the redirection was nearly finished already Big Grin

you just have to add one line to the template member_login:

<input type="hidden" name="url" value="$_SERVER[HTTP_REFERER]">

(I think it is best to put it under the other hidden field).

regards,
Philip
<input type="hidden" name="url" value="$HTTP_REFERER">

The above code will work too. Wink
oh.. great... and you tell that now?!? ;-)

no, kidding... great work, small, flexible and very elegant! Big Grin

But $HTTP_REFERER will not work with register_globals deactivated or am I wrong? (but myBB relies on some globals though..)

but who uses that anyway ;-)

regards,
Philip
Yes, you should try your best to work with $_SERVER[HTTP_REFERER]; just remember that some browsers and systems can be tweaked to hide this information so it's not really a fool-proof method.

Smile
yes, this must still be implemented, as I posted above.
But probably it makes more sense to check if the URL starts with and not contains the http://, as I just recalled that some Referer blockers place a link to their site in there like "blocked tieh FakeBlocker (http://blocker.net)