Skip to main content
Notice removed Authoritative reference needed by uwe
Bounty Ended with tostinni's answer chosen by uwe
Notice added Authoritative reference needed by uwe
Bounty Started worth 50 reputation by uwe
added 420 characters in body
Source Link
uwe
  • 12k
  • 16
  • 93
  • 173

I added a custom submit function to the user registration form. I want to be able to redirect to the user profile edit. How can I get the uid of the record that is about to be created? global $user doesn't work:

function my_user_register_submit ($form, &$form_state) { global $user; $form_state['redirect'] = 'user/' . $user->uid . '/edit?registration=1&destination=blahblah'; } 

Edit:

My use case is this: after registration I want to redirect the user to the "edit profile" page to complete the remaining profile fields. When they "skip" that or complete the form they go to their profile page. However, when a ?destination parameter is passed into the register form I want to carry that value to the "edit profile" page and then direct the user to that destination page when they are done.

I added a custom submit function to the user registration form. I want to be able to redirect to the user profile edit. How can I get the uid of the record that is about to be created? global $user doesn't work:

function my_user_register_submit ($form, &$form_state) { global $user; $form_state['redirect'] = 'user/' . $user->uid . '/edit?registration=1&destination=blahblah'; } 

I added a custom submit function to the user registration form. I want to be able to redirect to the user profile edit. How can I get the uid of the record that is about to be created? global $user doesn't work:

function my_user_register_submit ($form, &$form_state) { global $user; $form_state['redirect'] = 'user/' . $user->uid . '/edit?registration=1&destination=blahblah'; } 

Edit:

My use case is this: after registration I want to redirect the user to the "edit profile" page to complete the remaining profile fields. When they "skip" that or complete the form they go to their profile page. However, when a ?destination parameter is passed into the register form I want to carry that value to the "edit profile" page and then direct the user to that destination page when they are done.

Tweeted twitter.com/#!/StackDrupal
Source Link
uwe
  • 12k
  • 16
  • 93
  • 173

How can I do a custom form redirect on the user registration form?

I added a custom submit function to the user registration form. I want to be able to redirect to the user profile edit. How can I get the uid of the record that is about to be created? global $user doesn't work:

function my_user_register_submit ($form, &$form_state) { global $user; $form_state['redirect'] = 'user/' . $user->uid . '/edit?registration=1&destination=blahblah'; }