0

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)

0

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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.