I've searched all of the forum (finding lots of solutions, but none works after 1.1.3 update) for a reason as to why my login redirecting stopped working after I updated to 1.1.3.
when I ran 1.1.2 I used the following code with success (not the standard ssi way I know, but it worked none the less)
<form id="form1" method="post" action="forum/index.php?action=login2&front_url=index.php" accept-charset="ISO-8859-1">
at my mainpage, and edited the loginout.php file a bit so it read
// Set the login_url if it's not already set.
if (empty($_SESSION['login_url']) && isset($_SESSION['old_url']) && preg_match('~(board|topic)[=,]~', $_SESSION['old_url']) != 0)
$_SESSION['login_url'] = $_SESSION['old_url'];
if (isset($_GET["front_url"])){
$_SESSION['login_url'] = "mymainpage.com";
}
after 1.1.3 that doesn't work anymore. Then I tried the standard ssi way of doing it ie.
<?php
require("forum/SSI.php");
$_SESSION['login_url'] = "http://mymainpage.com";
ssi_login();
or
ssi_login('mymainpage.com');
?>
but none of them seems to work either, no matter what I try, I'm redirected to the index page of the forum, after successful login. as you might have figured I'm interested in making it reload the mainpage of my website instead.
Anyone want to enlighten me, as I seem to have run out of ideas.
As it worked pre 1.1.3 I can't imagine that any of my forum settings should be wrong, as it's the exact same, but just to clear the air, I've got 'Enable local storage of cookies' and 'Use subdomain independent cookies' unticked, andI've tested with 'Use database driven sessions' on and off to no avail at all.
Again, I searched and looked through tons of pages concerning almost similar problems, but none seemed to do me any good.
Any help appreciated as it's starting to drive me nuts.
KD
having the same problem with this one, too.
Same problem here as well
uhm.. so wats our resolution on this? hihihi.
If you want to redirect the user to an existing action page (like profile or something else), this quick workaround might help.
Edit LogInOut.php this way (insert $_SESSION['login_url'] = 'action=your_action'; after the global statements):
function Login2()
{
global $txt, $db_prefix, $scripturl, $user_info, $user_settings;
global $cookiename, $maintenance, $ID_MEMBER, $modSettings, $context, $sc;
global $sourcedir;
$_SESSION['login_url'] = 'action=profile';
Note: do not add index.php? as it already stated by the script.
ic..and wat if i want to an external page?
Quote from: radj on September 02, 2007, 08:10:44 AM
ic..and wat if i want to an external page?
er... haven't figured out yet... :(
$_SESSION['login_url'] = 'http://other.com/url';
hmmm..editing LogInOut.php does not seem to work for me..
So, the fact stands - there's no way to redirect at login any more? I've gone through all faq's and threads once again, with no luck. Anyone want to prove me wrong? Please..
actually,it works.. editing LogInOut.php.. it does now.. I don't know what I did..
Quote from: radj on September 10, 2007, 07:55:11 PM
actually,it works.. editing LogInOut.php.. it does now.. I don't know what I did..
lol, maybe you can post your Loginout.php and we'll figure it out how you did it. :)
I just followed reply #4. That's the only change i made in the file.
cool, thx very much, it's working great :D
Hmm can someone post their code they got to work when not redirecting to an action page? I basically have my login on my main page (not forum) and when the user logs in I want that page to just refresh itself with the user logged in instead of going to forums.
Noone knows how to redirect after login to a non smf page? (basically my main home page, not forums)
use this
$_SESSION['old_url'] = 'ur.url.com';
it will force all logins to go to the URL after this is set, even if logging in via forums.
hope it helps.
wait.. here's another way.. this will force user to go to the URL after SUCCESSFUL login whether logging in from forums or from other pages
look for this code in LogInOut.php:
// Beyond this point you are assumed to be a guest trying to login.
if (!$user_info['is_guest'])
redirectexit();
add your URL as parameter of redirectexit..
// Beyond this point you are assumed to be a guest trying to login.
if (!$user_info['is_guest'])
redirectexit('the.url.com');