Download & Extend

Custom token-based redirect after registration

Project:Invite
Version:6.x-2.0-beta3
Component:Code
Category:support request
Priority:normal
Assigned:Unassigned
Status:active

Issue Summary

I'd like to redirect a user, after registering, based on a custom token value embedded in their invite email join link.

Problems are, if I:

  1. use my own token value: "http://site.com/user/register?desination=/node/...", then invite module's tracking doesn't activate
  2. append my token value: "?destination=/node/...." to the end of [node-link], then it immediately redirects to my node - totally bypasses registration
  3. append my token value: "?inf=/node/...." to the end of the [node-link] - for use in a $form['#redirect'] - the invite module clears out my token value

Any ideas on how i can insert into or turn off invite module's redirecting?

Comments

#1

Oops in the above please replace [node-link] with [join-link]

#2

My solution works, however i wonder if there's a more elegant way?

I appended my token value: "?redirect=/node/...." to the end of [node-link] in the body of the invite email. Before the invite module clears my redirect parameter I grab it in my custom module function (see below) that stores it in the $_SESSION var - which is accessed later in a user form_alter to set $form['#redirect'].

function your_module_user($op, &$edit, &$account, $category = NULL) {
if ($op == 'load') {
    if ($_GET['redirect']) {
//Store the redirect parameter for a user who was sent an invite email
//See form_alter - $form['#redirect'] for use of $_SESSION['redirect']
global $_SESSION;
$_SESSION['redirect'] = $_GET['redirect'];
}
}
}

Is there a better place to set my $_SESSION var then in the hook_user?

Also note that i unset $_SESSION['redirect'] in a user submit handler.

nobody click here