Drupal: Display success/error message
Asked Answered
F

3

10

how can I show users success/error messages without creating a node for it?

Thanks in advance!

Fight answered 19/3, 2010 at 10:7 Comment(1)
Need clarifications. Node is not used for printing error messages. Usually it showed via drupal_set_message('message', $status);Compony
U
19

drupal_set_message($msg, $type = 'status'); lets you set a message, it will be displayed automatically on the next (or current) page the user visits.

The optional second argument lets you choose between an informational message (status), a warning (usually yellow) or an error (red).

See the docs: http://api.drupal.org/api/function/drupal_set_message/6

Uzia answered 19/3, 2010 at 10:12 Comment(0)
F
0

Not really too sure what your question is, in your theme, there will be the variable

<?php
    print $messages;
?>

This will print any success/error messages to the screen. They are not stored as nodes.

For a complete list of drupal variables see the documentation

Formula answered 19/3, 2010 at 10:9 Comment(2)
Any ideas on best ways to get these messages from within the node template?Oquendo
I tried 2 modules, Inline Messages drupal.org/project/inline_messages and Inline Form Errors drupal.org/project/ife, ended up using the latter and submitted a patch for both modules. Delivers nicely.Oquendo
M
0

Use this code in settings.php to disable the error messages:

$conf['error_level'] = 0;

See this blog: from here

Mcalister answered 26/3, 2021 at 4:46 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.