Code snippet to change notification of new users

If you find this free website useful – why don’t you support this with a donation? It is easy…. read more ….

Example plugin to set admin notification of new users. In this case it uses the first user defined as shop_manager role

<?php
/*
 *
 * Plugin Name:       Notify New Users to Shop Manager
 * Plugin URI:        https://fullworks.net/products/custom-plugin-development/
 * Description:       Needs Woo Commerce of Course
 * Version:           1.0
 * Author:            Fullworks
 * Author URI:        http://fullworks.net/
 * License:           GPL-3.0+
 * License URI:       http://www.gnu.org/licenses/gpl-3.0.txt
 */


function admin_email_callback( $wp_new_user_notification_email,  $user,  $blogname ) {
    $shopmanager = get_users( array( 'role' => 'shop_manager' ) );
// set the to: the first shop manager email.
    $wp_new_user_notification_email['to'] = $shopmanager[0]->user_email;
    return $wp_new_user_notification_email;
}
add_filter( 'wp_new_user_notification_email_admin', 'admin_email_callback', 10, 3 );

Download this as a plugin from fullworks -> https://fullworks.net/wp-content/uploads/2018/02/set-shop-manager-new-user.zip


Posted

in

, ,

by

Tags:

Comments

Leave a Reply

Your email address will not be published. Required fields are marked *