Redirect to another form on login I have created a test site using drupal 7.

My requirement is to do an additional operation on user login.
I need to redirect the users to another form when the user clicks on login button.

In this form there will be a question and 2 buttons 'update' and 'no'.

If the user chooses update a DB update will happen and also default login action.

But if the user chooses 'no' ,login should not happen.

I have already tried user_login alter, multi-step forms and confirm_form. But nothing seems to be working. Can anyone help.?
You can make your own login form (or alter default login form, i think) with two submit buttons calling different callback functions:

function xxx_login_form($form, &amp;$state) {

  // .. usename and password fields here

  $form['submit_update'] = array(
    '#type' =&gt; 'submit',
    '#value' =&gt; t('Update'),
    '#submit' =&gt; array('xxx_login_submit_update'),
  );

  $form['submit_no'] = array(
    '#type' =&gt; 'submit',
    '#value' =&gt; t('No'),
    '#submit' =&gt; array('xxx_login_submit_no'),
  );

  return $form;

}

function xxx_login_submit_update($form, &amp;$state) {

      if(user_authenticate($state['values']['username'], $state['values']['password'])) {
        // log in user
        $user_obj = user_load_by_name($username);
        $form_state = array();
        $form_state['uid'] = $user_obj-&gt;uid;      
        user_login_submit(array(), $form_state);

        // .. do some updates

        return true;
      } else {
        return false;
      }

}

function xxx_login_submit_no($form, &amp;$state) {

   // do what you need but do not log user in.

}


You can of course add custom validate functions, messages or what you need. If you want redirect to another page after button is pressed, you can use 

'#action' =&gt; 'some/page/1'


for the buttons.