How to show a message to a user?

From a plugin how can I show a message to a user?

Specifically I'd like to show a message to any user after comment submission indicating that their comment was submitted. My thought was to hook into the comment_post action.

However in searching for this I could not find an answer to the more general problem of how to show a message to a user. The message should be shown to the user a single time regardless of whether they are logged in or not on their next page visit. Similar to drupal's drupal_set_message (see https://stackoverflow.com/questions/2476351/drupal-display-success-error-message)

Topic notifications comments plugins Wordpress

Category Web


You could use javascript if you wanted. So wherever the button click is checked, you could add something like this:

<?php
    $message = "Your comment has been submitted";
    echo "<script type='text/javascript'>alert('$message');</script>";
?>

That is if it is supposed to happen when they click the button - I might be misinterpreting the question.

About

Geeks Mental is a community that publishes articles and tutorials about Web, Android, Data Science, new techniques and Linux security.