Broken_Umbrella Posted July 1, 2010 Share Posted July 1, 2010 I am using JomSocial on my site, which is a community-type plugin for Joomla!. Their login module only redirects people to their profile page. What I want is to redirect them to the last page they were on. However, when someone logs in for the first time, they will be logging in from a page that has an activation token in the URL. If you try to redirect back to a URL with a token in it, the user will either get an error message or a blank page. What I've tried to do is use the Stripos function to find "activate-account/?activation=" in the URL. If it finds that, I want it to redirect the user to their profile. If it doesn't find that, I want the user redirected back to the originating page... make sense? I believe the problem is that the Stripos function never seems to find "activate-account/?activation" in the URL, so it always redirects back to the originating page. Here's the code I have so far. If there is a better way to code this redirect, let me know, I am definitely open to options. Any help is greatly appreciated. function getHelloMeLoginHTML($params, $type, $user) { $findme = 'activate-account/?activation='; $mystring1 = $uri; $pos1 = stripos($mystring1, $findme); $uri = JFactory::getURI(); if ($pos1 === false) { $uri = $uri->toString(array('path', 'query', 'fragment')); $uri = base64_encode($uri); } if ($pos1 !== false) { $uri = CRoute::_('index.php?option=com_community&view=profile' , false ); $uri = base64_encode($uri); $html = ''; } Quote Link to comment https://forums.phpfreaks.com/topic/206459-need-to-redirect-users-logging-in/ Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.