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 …
Category: Web

After form submission want to show success message in the form page

Admin side I submit form to admin-post.php. I want to print success message in the bottom of the form. Iam new in wordpress what i did shown below. admin.php?page=add-products form code <form action="<?php echo admin_url('admin-post.php') ?>" method="post"> <table> <input type="hidden" name="action" value="add_product_from_admin"> <tr><td>Name</td><td><input type="text" name="pr_name" id="pr_name"></td></tr> <tr><td colspan="2" align="center"><input type="submit" name="pr_submit" id="pr_submit" value="Save Products"></td></tr> </table> </form> add_action( 'admin_post_add_product_from_admin', 'add_product_into_data_base' ); function add_product_into_data_base() { //some database operations wp_redirect(admin_url('admin.php?page=add-products&message=success')); }
Category: Web

Display alert on successful user Sign Up

I think wordpress used to automatically redirect to a page with a message telling a newly registered user to check their email box to activate their account. For some reason, when a new person registers now, they are automatically redirected to the home page with no alert or message. I've been trying to get wordpress to display an alert to the user after clicking "Sign Up" with: add_action('user_register','check_your_email'); function check_your_email(){ echo "<script> alert('There are no fields to generate a report'); …
Category: Web

custom error message or redirect to custom page if any error occurs

I want to create custom message when site got any error or broken or it is also be helpful if I can redirect site url to my custom page when site got error for example "www.demo.com" to "www.demo.com/custom-error-message-page" where I can display my message to visitors and also want those error to notify in my email. I have tried wp_debug in wp-config to set to true but it shows all error on all pages of site instead that I only …
Category: Web

comment_notification_text filter not working

I want to customize notification for post author when comment is posted. My code in functions.php is : //add notifications when comment add_action( 'wp_insert_comment', 'wp_notify_postauthor' ); //change email notification comment function wpd_comment_notification_text( $notify_message, $comment_id ){ // get the current comment and post data $comment = get_comment( $comment_id ); $post = get_post( $comment->comment_post_ID ); // don't modify trackbacks or pingbacks if( '' == $comment->comment_type ){ // build the new message text $notify_message = sprintf( __( 'New comment on your post "%s"' …
Category: Web

Disable email notification after change of password

I want to disable the email notification if a user or an admin changes the password of a user. After some Googling I came to find that I need to create a plugin and overwrite the wp_password_change_notification function found in pluggable.php. This is the plugin and function: <?php /* Plugin Name: Stop email change password Description: Whatever */ if ( !function_exists( 'wp_password_change_notification' ) ) { function wp_password_change_notification() {} } ?> I uploaded the file to my plugin folder and activated …
Category: Web

Delete "Post Published. View Post" for custom post type

I'm working on a plugin with a custom post type called "important_dates" I want to delete the Wordpress admin notification when a new custom post is created. Here is my code - it deletes the notifications for all post types. How do I make it work for only my "important_dates" custom post type? add_filter( 'post_updated_messages', 'post_published' ); function post_published( $messages ) { unset($messages['posts'][6]); return $messages; } }
Category: Web

How to disable the "Your site has updated to WordPress x.y.z" admin email?

Using the automatic update of my self-hosted WordPress blogs, I configured automatic updates of both the WordPress core as well as WordPress plugins and themes (through this plugin). Whenever a core update occurs, I get an email like: Your site has updated to WordPress 3.9.2 Howdy! Your site at http://example.org has been updated automatically to WordPress 3.9.2. No further action is needed on your part. For more on version 3.9.2, see the About WordPress screen: http://example.org/wp-admin/about.php If you experience any …
Category: Web

How to display Real-Time notifications (via Icons) in WordPress

I'm trying to use icons to communicate messages between an Admin and the site's Registered Users (both collectively and individually): An Admin to posts a message in some type of back-end interface (Custom Post Type, maybe?) The Admin can designate the individual user(s) or all users (for a site-wide messages) The user(s) see the all the message since the user last logged in via a well recognizable "bell" icon with numbers indicating the number of new messages. See my example …
Category: Web

How to send automatic response after form submission without plugin

I create an ajax form and I well received the email. Now, I just want to do like CF7, send an automatic response to the sender to notify him that I well received the form. Which function used or which hook ? Apart from Reply_to with Headers of wp_mail I didn't find any solution to send confirmation or notification. Anybody can fill the form. Here php code to send the form : function mail_form(){ if ( ! wp_verify_nonce( $_POST['nonce'], 'ajax-nonce' …
Category: Web

Modify wp_installed_email / wp_new_blog_notification

When WordPress is installed, it sends a notification New WordPress Site Your new WordPress site has been successfully set up at: ... I would like to change the text of the e-mail but am not successfull. Here is what I tried: I added the following code to the main file of a plugin which I add before the installation function changed_install_mail($installed_email, $user, $blog_title, $blog_url, $password ) { $installed_email['subject'] = 'test'; return $installed_email; } add_filter( 'wp_installed_email', 'changed_install_mail', 10, 5 ); I …
Category: Web

Wordpress, Mailchimp, Campaigns - should separate campaigns be used for something like notifying users of drip content?

I am new to integrating Wordpress and Mailchimp. I have a Wordpress site that offers music courses. Within a course are several lessons. I drip the lessons weekly, so that each lesson starts on a Monday. I just added Mailchimp support via my site's composer.json by adding "require": { "mailchimp/marketing": "*" } I can now use the Mailchimp API via require_once ABSPATH.'/vendor/autoload.php'; use MailchimpMarketing\ApiClient as MailChimp; $mailchimp = new Mailchimp(); $mailchimp->setConfig([ 'apiKey' => MAILCHIMP_APIKEY, 'server' => MAILCHIMP_SERVER_PREFIX ]); So all …
Category: Web

Send notification to the admin when new custom post is submitted

I have a cpt called "auto" and i make a frontend form to create new post with "pending" status. After the post submission i would receive an email with a notification of the new post. function newpost_notify() { $mailadmin = '[email protected]'; $subject = 'Subject'; $headers = 'MIME-Version: 1.0' . "\r\n"; $headers .= 'Content-type: text/html; charset=UTF-8' . "\r\n"; $headers .= 'From: xxx <[email protected]>' . "\r\n"; $message = 'There\'s a new post.'; wp_mail( $mailadmin, $subject, $message, $headers ); } add_action( 'publish_post', 'newpost_notify', …
Category: Web

Need to suspend RSS feed while repairing missing old post

Some old posts were accidentally removed from my self hosted site. I started replacing them from back-ups, but the people who subscribe to my WordPress Feed (and email notification) complained they were being spammed with old posts. Is there a way to turn off both the RSS feed and the email notification the next time I restore missing posts? This needs to be temporary. There are disable RSS plug-ins, but they seem to be about killing RSS altogether rather than …
Category: Web

How can admins to be notified of changes when users change their WP profiles?

I'm using the code below that I found in another thread. When a user makes changes to their profile, this snippet sends an email notification that something has been changed. I'd like to amend this so that we can be notified which fields specifically (Name, email, phone, etc) have been changed. Is there a simple way to achieve this by amending this code? I'm pretty new to php and coding i general so please explain like I'm dumb. Thank you …
Category: Web

How to drip out preloaded WordPress blog posts via email

I'm in the process of loading up a WordPress site with content. When a user subscribes to the site, instead of getting only new blog posts, I'd like that user to be "dripped" all blog posts from the beginning, one per day. Is that possible via a plug-in or a third-party "drip" provider, or does something need to be built?
Category: Web

About

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