I've done a bunch of work with codeigniter, cakephp, zend, magento and they all have methods for setting what I've heard called flashdata errors.
see:
- http://inchoo.net/ecommerce/magento/magento-frontend/utilizing-magento-notification-system/
- http://ellislab.com/codeigniter/user-guide/libraries/sessions.html
This is basically a value set in session that every page looks for and if found displays then clears from the session so that it is only displayed once.
Typically these are displayed in the form of a popup or small short lived box that is color coded depending on the level.
Ex: message : blue success : green warning : yellow error : red
Is there something like this within wordpress where you can for instance do some business logic through a post to say "wp_ajax" or "wp_ajax_nonpriv" and if something breaks redirect to the previous page after adding a flash data error?
If you want to display flash messages within the wp-admin area, you can add an action to
admin_notices
hook. It would work like this (taken from here and here):As for the CSS classes, looks like there are few options:
But that shouldn't keep you from creating your own CSS classes and using them.
If you want to display the messages outside wp-admin, you might need to develop your own solution or get user generated solutions. Unfortunately WP doesn't have a built-in functionality for that as it may vary from theme to theme.