Page 1 of 1

Redirect after registration with SelfRegistration

Posted: Tue Mar 15, 2011 10:55 pm
by sjo123
In SelfRegistration preferences I have

Don't display the final message after registration=checked
PageID/Alias to redirect to after registration is complete=home

What I want to do is redirect to a page based on a parameter passed when calling the module as you can do when logging in with FEU.

In FEU we can call the module with
{cms_module module=FrontEndUsers form="login" nocaptcha="1" returnto="home"}

or we could call the module with
{cms_module module=FrontEndUsers form="login" nocaptcha="1" returnto="some-other-page"}

I need to achieve the same thing in the SelfRegistration module.

Thanks for any help.

Re: Redirect after registration with SelfRegistration

Posted: Wed Mar 16, 2011 12:24 am
by jmcgin51
sounds like a good FR for SelfRegistration. Until it becomes part of the module proper, I would suggest that you set the redirect in the SelfReg preferences to a "redirect" page, which contains Smarty code or a UDT to dynamically redirect to a different page based on whatever criteria you select.

Re: Redirect after registration with SelfRegistration

Posted: Wed Mar 16, 2011 1:50 am
by sjo123
This worked

Changed
PageID/Alias to redirect to after registration is complete=home
to
PageID/Alias to redirect to after registration is complete=redir

Created page redir with content below
{php}
if (isset($_SESSION['selfreg_returnto'])){

global $gCms;
$manager =& $gCms->GetHierarchyManager();
$node =& $manager->sureGetNodeByAlias($_SESSION['selfreg_returnto']);
$content =& $node->GetContent();
if (isset($content) && is_object($content)){
if ($content->GetURL() != ''){
redirect($content->GetURL());
}
}else{
echo 'redirect udt - page not found: '.$_SESSION['selfreg_returnto'];
}

}else{

echo 'returnto session var not found: ';

}
{/php}

Now I call SelfRegistration
{cms_module module=FrontEndUsers form="login" returnto="home"}
or
{cms_module module=FrontEndUsers form="login" returnto="some-other-page"}

Thanks for that.