I'm in the process of re-coding and updating my CMS I've got working in CI2, to CI3, and for the life of me I cannot get my redirect function to work for me on CI3.
Outside of redesigning my Models, my code thus far is is identical to my CI2 code. Originally I suspected my layout hook was the culprit, but I've completely disabled him and I'm still not getting anywhere.
public function login ()
{
//var_dump(logged_in());
//if (logged_in())
redirect('/user/');
}
Above is the entirety of my login function at the moment, from my User controller. I've removed all the other code in an effort to pinpoint this problem. I've even commented out the if
statement thinking that it might even by the culprit. nope.
My logged_in()
function returns TRUE, or FALSE, depending on certain things set in my user sessions. That appears to be functioning fine. As far as I can tell, my configs settings looks good. I have the URI helper autoloaded, and other URI helper methods function properly.
Now for the strange part. When I visit /user/login, not only does my page not redirect, if I un-comment the var_dump()
before the redirect (which returns true), and re-comment it, the page doesn't update, and I have bool(true)
on my screen regardless. If the var_dump
is commented and I open a new tab to users/login
it simply doesn't load anything, and it just hangs out as a new tab.
Edit: I've forgotten to mention that when I use the 'refresh' flag (redirect('/user/', 'refresh');
), that simply takes me to an about:blank page.
Edit#2: I've copied the CI3 files into a new "project", and even those wont redirect using the built in Welcome_Message view/controller combo.