• Resolved gbordormor22

    (@gbordormor22)


    I want to ask if it’s possible to send Automated Birthday SMS with WP SMS?

    For example, yesterday was my Birthday, and I received this from my Bank— https://prnt.sc/c9uudDWWjlA6

    How can I achieve this kind of Automated Birthday SMS with WP SMS?

    Regards.

Viewing 7 replies - 1 through 7 (of 7 total)
  • Plugin Support Amir

    (@amirfallah)

    Dear user,

    Thank you for your suggestion regarding the possibility of sending Automated Birthday SMS with the WP SMS plugin.

    Unfortunately, the current version of the WP SMS plugin does not directly offer the functionality to send automated birthday SMS messages. However, I can provide you with a helpful tutorial that you can use to implement this feature on your website.
    Automated Birthday SMS Notifications in WordPress Using WP SMS

    This tutorial will guide you through the process of setting up automated birthday SMS notifications using the WP SMS plugin. By following the steps outlined in the tutorial, you’ll be able to achieve the desired functionality on your website.

    Additionally, I would like to inform you that we are actively working on incorporating this feature into the core functionality of the WP SMS plugin. In the upcoming updates, we aim to add a dedicated option that will allow you to enable automated birthday SMS notifications with just a few clicks. This will provide a more seamless and integrated solution for our users.

    Thank you again for your valuable feedback. We appreciate your interest in the WP SMS plugin, and we’ll be sure to keep you informed about the availability of the automated birthday SMS feature in future updates.

    Best regards,

    Thread Starter gbordormor22

    (@gbordormor22)

    Thank You for this awesome reply.

    Now, is it the Free or Pro version that will enable achieve what you have in the Tutorial here– ( https://wp-sms-pro.com/26388/automated-birthday-sms-notifications-in-wordpress-using-wp-sms/ )

    Needing to hear from you soon.

    Regards.

    Plugin Contributor VeronaLabs Support

    (@veronalabs)

    Good to hear.

    It’s in free version ??

    Best

    Thread Starter gbordormor22

    (@gbordormor22)

    I have a WordPress website that is powered by Ultimate Member plugin.

    This Ultimate Member plugin allows our users to create User Profiles without ever reaching the WP Admin dashboard.

    Now, I have users with a Birthday Field, as you can see here— https://prnt.sc/c3l8mIk81zb5

    Can I pull this Birthday Field with WP SMS, and be able to send Automated Birthday Greetings to my Users, whose Profiles were created through Ultimate Member, and not directly through the Profile backend of the WP Admin Dashboard?

    Needing to hear from you soon.

    Regards.

    Plugin Contributor VeronaLabs Support

    (@veronalabs)

    Alright, since the storing birthday field and handled with Ultimate Member, the only need to do is using this code:

    function send_birthday_sms_daily()
    {
        $today                     = date('m-d');
        $args                      = array('meta_query' => array(array('key' => 'birthday_field_name', 'value' => $today, 'compare' => 'LIKE')));
        $users_with_birthday_today = get_users($args);
    
        foreach ($users_with_birthday_today as $user) {
            $user_mobile = \WP_SMS\Helper::getUserMobileNumberByUserId($user->ID);
            if (!empty($user_mobile)) {
                wp_send_sms($user_mobile, 'Happy Birthday! Hope you have a fantastic day!');
            }
        }
    }
    
    if (!wp_next_scheduled('send_birthday_sms_daily_hook')) {
        wp_schedule_event(time(), 'daily', 'send_birthday_sms_daily_hook');
    }
    add_action('send_birthday_sms_daily_hook', 'send_birthday_sms_daily');

    Don’t forget to replace the birthday_field_name field name.

    Best

    Thread Starter gbordormor22

    (@gbordormor22)

    In your schedule, you wrote the time to be daily, as seen here— wp_schedule_event(time(), ‘daily’, ‘send_birthday_sms_daily_hook’);

    Suppose I want the SMS to be delivered by 6am in the morning, How do I adjust the time in your code?

    And can you make the time to be 6am using the String To Time(strtotime) format?

    Regards.

    Plugin Author Mostafa Soufi

    (@mostafas1990)

    So, here you go

    function send_birthday_sms_daily()
    {
        $today                     = date('m-d');
        $args                      = array('meta_query' => array(array('key' => 'birthday_field_name', 'value' => $today, 'compare' => 'LIKE')));
        $users_with_birthday_today = get_users($args);
    
        foreach ($users_with_birthday_today as $user) {
            $user_mobile = \WP_SMS\Helper::getUserMobileNumberByUserId($user->ID);
            if (!empty($user_mobile)) {
                wp_send_sms($user_mobile, 'Happy Birthday! Hope you have a fantastic day!');
            }
        }
    }
    
    if (!wp_next_scheduled('send_birthday_sms_daily_hook')) {
        $next_six_am = strtotime('tomorrow 6am');
        
        wp_schedule_event($next_six_am, 'daily', 'send_birthday_sms_daily_hook');
    }
    
    // Hook the function to the scheduled action
    add_action('send_birthday_sms_daily_hook', 'send_birthday_sms_daily');
Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘Automated SMS Birthday Notification’ is closed to new replies.