1

I have a node that has a cck field that has a link, when the person clicks on it, I need them to sign up then redirect to that link.

Is that possible?

logintoboggan, rules and login destination cant achieve this, they only send to one defined page.

1
  • Correct me if I"m wrong. Anonymous user -> sign up, then redirect to link. Authenicated users -> go direct to the link
    – iStryker
    Commented Jul 8, 2011 at 12:16

2 Answers 2

0

When you redirect to the login or registration page you can add a destination GET parameter to the url, which Drupal will redirect to after form submission.

1
0

Create a custom module and implement hook_menu


function YOURMODULENAME_menu() {
  $items = array();
    $items['checkuser'] = array(
      'title' => '',
      'page callback' => 'check_user',
      'access arguments' => array('access content'),
  );
  return $items;
}

fucntion check_user() {
  $destination = $_GET['destination'];
  $is_login = user_is_logged_in();
  if($is_login) {
    drupal_goto($destination);
  }
  else {
    $options = array('query' => $destination);
    drupal_goto('user/register', $options);
  }
}

Use below snippet in your node template


l('Title', 'checkuser', array('query' => array('destination' => 'destination_url')));

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.