How to pass on the user id(block user) after registration I am working on a project where users need to pay to use site.Site have a registration form where user can register and redirected to the payment page.All the resisted users are blocked until they make payment.
The registration process working fine but, when user redirects to payment page there is no method to get resisted user id. How to get registered user id on payment page?
The user registration form is generated by user_register_form(), and like normal Drupal forms, it can be altered via hook_form_alter or hook_form_FORM_ID_alter. When not explicitely set, the submit handler of a form is named form_id_submit(), however, in user_register_form, a submit handler is added to the #submit property of the form - user_register_submit().

In the function user_register_submit, you'll notice the following codes:

...
$form_state['user'] = $account;
$form_state['values']['uid'] = $account-&gt;uid;
...


which saves the new user object and ID in $form_state.

To access this after the registration form is submitted, simply add a custom submit handler via hook_form_alter() or hook_form_FORM_ID_alter(). Example:

/**
 * Implements hook_form_FORM_ID_alter().
 *
 * Alters the user registration form by adding a custom submit handler.
 */
function foo_form_user_register_form_alter(&amp;$form, &amp;$form_state) {
  $form['actions']['submit']['#submit'][] 'foo_user_register_form_submit';
}

/**
 * Custom submit handler for the user registration form.
 */
function foo_user_register_form_submit($form, &amp;$form_state) {
  $account = $form_state['user'];

  $uid = $form_state['values']['uid'];

  // Do something meaningful
}