Code snippet to change notification of new users


Fully Managed UK Hosting – Only £1+VAT till 1st Jan 2021 on Shared, Reseller and Dedicated Hosting! …. 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

[Next] Find out where to host WordPress [Read the full article…]

, ,

Leave a Reply

Your email address will not be published.