Active
Project:
Ajax
Version:
6.x-1.9
Component:
Code
Priority:
Normal
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
25 Nov 2009 at 20:52 UTC
Updated:
17 Sep 2010 at 14:36 UTC
This was a pesky bug, where our dpm() messages (drupal_set_message()) we were using for debugging a login issue were disappearing. After chasing down a bunch of red herrings, we just realized that the ajax module is obliterating messages when ajax_validator() runs. The two things I don't get are why this is running AFTER hook_user() runs, and two: why obliterate all the messages anyway? Was this intended?
/**
* Validation handler callback
*
* @param $form Assoc
* @param $form_state Assoc
* @return Bool
*/
function ajax_validator(&$form, &$form_state) {
if (array_key_exists('drupal_ajax', $_REQUEST)) {
// BYE BYE MESSAGES
drupal_get_messages(NULL, TRUE);
$data = ajax_build(array(
'messages_error' => form_get_errors(),
'form_id' => $form_state['values']['form_id'],
'options' => $form['#ajax']
));
// FAIL
if (!$data['status']) {
ajax_invoke_validate_fail($form, $form_state, $data);
ajax_out($data);
}
// PASS
else {
$pass = TRUE;
ajax_invoke_validate_pass($form, $form_state, $data, $pass);
if (!$pass) {
ajax_out($data);
}
}
}
return TRUE;
}
Comments
Comment #1
frankcarey commentedbump
Comment #2
saipas commentedHey,
same issue here. Commenting 'drupal_get_messages' doesn't change anything.
Comment #4
nicoloye commentedsame issue here too.