here's a demo module that should set a drupal message when either the 'send' or the 'user_edit' forms are submitted:
<?php
function sendtest_form_alter($form_id, &$form) {
if ( $form_id == 'send' || $form_id == 'user_edit' ) {
// msg appears on both user_edit AND on send form
drupal_set_message('sendtest_form_alter() called');
$form['#submit']['sendtest_process_send_form'] = array();
// can overwrite #submit and it works fine with send, but of course send processing
// is never done
//$form['#submit'] = array('sendtest_process_send_form' => array());
}
}
function sendtest_process_send_form($form_id, &$form_values) {
// works on user_edit but NOT on send form
drupal_set_message('sendtest post submit function called');
return;
}
?>
This module works as expected if the user_edit form is submitted (message appears). But it does not work with the send form (send to a friend node form).
Comments
Comment #1
allie mickaThe issue you are having is the result of send's drupal_goto after it processes the form, which means it never gets to your submit callback. This happens on a variety of modules (e.g. webform).
There may be a better fix, but for now my reccomendation is to replace the following line:
With this one:
This will prepend your callback onto the #submit array, which will ensure that your code gets called before send does any sort of goto magic.