2
votes

I want my users to redirect to a custom URL after they successfully register in Joomla . I can't find any option for that ! How can I achieve this ?

3

3 Answers

0
votes

If you are using Joomla!'s built-in menu to load the registration page, or getting there from the Login module there isn't a way to redirect (which is odd because you can set a redirect after login in the login module).

The best place to start would be to look at existing solutions in the "Authentication" section of the Joomla! Extension Directory. It appears there are several listed that support both the old 1.5 style sites and the new 1.7/2.5 sites.

(By the way if you are still on 1.7 you should update to the latest 2.5 as there are serious security issues in the 1.7 line.)

0
votes

In your code set do the following;

$app=JFactory::getapplication();
$app->redirect('index.php?option=com_users&view=login'));
0
votes

You can achieve this with a plugin (at least in Joomla 3.x - not sure how far back this will work off-hand). Key here is the onUserAfterSave event, which tells you whether the user is new or existing.

I wrote the code below some time ago, so can't recall the exact reason the redirect could not be done from within the onUserAfterSave event handler, but I think the redirect is subsequently overridden elsewhere in the core Joomla user management code if you try to do it from there, hence saving a flag in the session and checking it in a later event handler.

class PlgUserSignupRedirect extends JPlugin
{
    public function onUserAfterSave($user, $isnew, $success, $msg)
    {
        $app = JFactory::getApplication();

        // If the user isn't new we don't act
        if (!$isnew) {
            return false;
        }

        $session = JFactory::getSession();
        $session->set('signupRedirect', 1);

        return true;
    }

    function onAfterRender() {
        $session = JFactory::getSession();
        if ($session->get('signupRedirect')) {
            JFactory::getApplication()->redirect('/my-post-signup-url');
            $session->clear('signupRedirect');
        }
    }
}