Is it possible to redirect away from the current page upon registration?

I've tried using rules + the login destination module, but to no avail - I can't seem to redirect, when the modal form closes the user is always back to the page that they came from.

Comments

michaelj’s picture

+

ckng’s picture

Version: 7.x-1.0 » 7.x-1.x-dev
Category: task » bug

Unable to get the redirection to work, am using total control dashboard with redirection option after login.
The redirected page is loaded in an alert box.

jaykainthola’s picture

You can use ctools_ajax_command_redirect() to redirect to other page.

areynolds’s picture

Thanks for the hint @jaykainthola, for fellow gumshoes, my path to greatness was as follows:

function some_form_submit(&$form, &$form_state){
	ctools_include('ajax');
        ctools_add_js('ajax-responder');
        $commands = array();
        $commands[] = ctools_ajax_command_redirect('some-redirect-path');
        print ajax_render($commands);
        exit;
}
jaykainthola’s picture

@areynolds Kindly check below code. I have used ajax_register module in one of my project. This is the code from that module on user register submit function.

$redirect_url ="";
ctools_include('ajax');
$commands = array();
$commands[] = ctools_ajax_command_redirect($redirect_url);
return array('#type' => 'ajax', '#commands' => $commands);

Thanks,

frjo’s picture

Category: bug » support
Status: Active » Fixed

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

areikiera’s picture

This can also be accomplished with Rules: also see: https://drupal.org/node/1873360

rajesh.vishwakarma’s picture

Issue summary: View changes

use destination for registration/login link on tpl file. For registration use:

echo l('Sign up here', 'user/register', array('query'=>array('destination'=>'thanks')));
gjpino83’s picture

Hello guys,

Could someone please help me to know where to add the code from #4? this one:

function some_form_submit(&$form, &$form_state){
	ctools_include('ajax');
        ctools_add_js('ajax-responder');
        $commands = array();
        $commands[] = ctools_ajax_command_redirect('some-redirect-path');
        print ajax_render($commands);
        exit;
}

Should I added to my template or create a custom module?

Thanks!