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

Hunabku’s picture

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

Hunabku’s picture

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.

dale42’s picture

Version: 6.x-2.0-beta3 » 6.x-2.x-dev
Issue summary: View changes
Status: Active » Closed (outdated)

I'm helping the Invite module maintainers by cleaning up old issues.

Drupal 6 is no longer supported so I'm setting the issue status to Closed (outdated). Information on what that means is here: Issue Status field.

If you have a question about one of the current versions of the module please do submit a new issue.