Enhance Registration Notifications with ‘wp_sms_admin_notify_registration’

Updated on Jan 09, 2023

Overview

The WP SMS plugin includes a filter called “wp_sms_admin_notify_registration” that allows you to modify the phone number of the admin who receives notifications when a new user registers on the WordPress site. This filter can be useful if you want to customize the phone number that notifications are sent to, or if you want to add additional recipients to the notifications.

Example

add_filter('wp_sms_admin_notify_registration', 'modifyAdminReceiversUserRegisterNotification');

/**
 * @param $adminMobileNumber array
 * @return array
 */
function modifyAdminReceiversUserRegisterNotification($adminMobileNumber)
{
    $adminMobileNumber[] = 01222323233;
    $adminMobileNumber[] = 01222323234;

    return $adminMobileNumber;
}

You can also use the ‘wp_sms_admin_notify_registration’ filter in the WP SMS plugin to send registration notifications to a specific group:

/**
 * @param $adminMobileNumber array
 * @return array
 */
function modifyAdminReceiversUserRegisterNotification($adminMobileNumber)
{
    $adminMobileNumber[] = \WP_SMS\Newsletter::getSubscribers(1); // Group ID

    return $adminMobileNumber;
}