If anyone could please advise me on how to delay $messages from firing until after a page has loaded I would tremendously appreciate it.

The issue I'm having is, users are filling out a form generated by a block, and the errors are triggered, but do not display, because the page has already loaded.

The form is printed with the following, on a node template:

$form = drupal_get_form('user_register_form'); print drupal_render($form);

If I understand correctly, the $messages variable is used on the page template level, and is therefore loaded before the form is ever loaded.

I've tried adding:

if(isset($messages)){ print $messages } to various parts of the node template. To no avail.

I've tried using: print theme_status_messages($variables); But am still experiencing the same behavior, and I've tried the steps recommended here:

Print $Messages in node.tpl.php file

Specifically, modifying the preprocessor_page and preprocessor_node functions as requested, and either that is not working, or I am not calling it correctly from the node template.

Thank you very much!

  • This would be the answer in case anyone ends up interested. $form = drupal_get_form('user_register_form'); print theme_status_messages($variables); print drupal_render($form); – Brian Smith Dec 4 '15 at 2:49