How to add a confirmation form upon submission of user profile form I have previously added a confirmation dialog to my own forms using a technique like http://blog.purdy.info/2014/04/how-to-work-with-confirmform-in-drupal-7.html.  However this assumes that you have control of the form builder and submit functions.  I now want to add a confirmation to the user profile form which is of course defined in the user module.

Any suggestions ?

Thx
You can add your own submit handler in front the of the predefined submit handler using hook_form_alter().

The #submit property is an array of submit handlers and it allows multiple values. Use array_unshift() to put your handler in front of the predefined handler.

Your code will look something like this:

/**
 * Implements hook_form_alter().
 */
function mymodule_form_alter(&amp;$form, &amp;$form_state, $form_id){
  if ($form_id = 'target_form') { // make sure it's the right form
    // add my handler
    array_unshift($form['#submit'], 'my_submit');
  }
}

function my_submit( $form, &amp;$form_state ) {
}


When the form is submitted, it will run my_submit() before the predefined submit handler.