Jump to content

Need to Redirect Users Logging In


Recommended Posts

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   = '';

    }

 

 

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.