Redirect after registration with SelfRegistration

Have a question or a suggestion about a 3rd party addon module or plugin?
Let us know here.
Post Reply
sjo123
New Member
New Member
Posts: 7
Joined: Sun Jul 11, 2010 6:07 am

Redirect after registration with SelfRegistration

Post 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.
jmcgin51
Power Poster
Power Poster
Posts: 1899
Joined: Mon Jun 12, 2006 9:02 pm

Re: Redirect after registration with SelfRegistration

Post 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.
sjo123
New Member
New Member
Posts: 7
Joined: Sun Jul 11, 2010 6:07 am

Re: Redirect after registration with SelfRegistration

Post 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.
Post Reply

Return to “Modules/Add-Ons”