Skip to:
Content

BuddyPress.org

Opened 12 months ago

Last modified 6 months ago

#9043 new feature request

Birthday Email Situation Trigger

Reported by: gbordormor22's profile gbordormor22 Owned by:
Milestone: Awaiting Contributions Priority: high
Severity: normal Version: 12.0.0
Component: Core Keywords:
Cc:

Description

BuddyPress has Emails by default, and we create these Emails normally as we create a normal Post in WordPress.

Now, these Emails are triggered by Situations, as you can see here– https://prnt.sc/iPp4iPfC5zvE

Unfortunately in BuddyPress, there’s no available situation to trigger the sending of Birthday Greetings Message to users, on the day of their Birthday.

Can BuddyPress add this feature soon?

Can BuddyPress make it possible that we can send Emails automatically to users on the day of their Birthday through an Email Situation trigger in BuddyPress Core?

Regards.

Change History (6)

#1 @imath
12 months ago

  • Milestone changed from Up Next to Awaiting Contributions

Hi @gbordormor22

Thanks a lot for your suggestion. I like this idea but I believe we’d need to work on a very customizable way of creating these kind of situations because the name of the birthday xProfile field can be very different in communities (birth date, date de naissance, etc..).
It would be easier imho to celebrate a member’s registration date.

So the API would need to let the admin pick the field, set the conditions etc… We’d also need to let the user decide whether he wants to receive these kind of emails.

That being said, I’d be very interested to see a proof of concept about it.

#2 @gbordormor22
12 months ago

@imath

When it is my Birthday, I receive an SMS Greeting and an Email Greeting from my Bank and Pension Fund Managers.

They wish me Happy Birthday on this my special day.

That for me, is my Proof of Concept.

Then, I've set up the same thing on this website using AutomatorWP-- https://member.cordialmarketplace.com/

Here's the Email message that users receive --- https://prnt.sc/zLybVgVrcWK0

Then we have Services that do Birthday Automation:

See here from MailChimp-- https://mailchimp.com/help/create-an-automated-birthday-email/

and here from Engage-- https://engage.so/blog/how-to-automate-birthday-message-with-engage/

While Gamification plugins reward people with points on their Birthdays.

See here from Gamipress--- https://gamipress.com/add-ons/gamipress-birthdays/

and here from MyCred -- https://mycred.me/store/mycred-birthdays/

From all these instances, Birthday is a situation in life that is celebrated.

BuddyPress should have an Email Situation for it.

IMPLEMENTATION
When BuddyPress loads, all existing Email situations should stay active by default as they've always been.

While the Birthday Email situation should stay inactive. It should require Admin to intentionally activate it.

When Admin activates it, there should be a Popup with a scrollable list of all xprofile fields on the website.

And this Popup tells Admin "Choose a field for this event?"

Notice should be visible at the bottom, that informs Admin "choose only a Date field for this action".

Now, Admin is expected to click on a Date field he will like to use for this event. Once selected and saved, that field becomes the basis for activating the Birthday Situation Emails.

See sample of the Popup--- https://prnt.sc/jVaX5NMf9RCS

I believe you can understand things from here onwards.

Regards.


Then

Version 0, edited 12 months ago by gbordormor22 (next)

#3 @gbordormor22
12 months ago

@imath

When it is my Birthday, I receive an SMS Greeting and an Email Greeting from my Bank and Pension Fund Managers.

They wish me Happy Birthday on this my special day.

That for me, is my Proof of Concept.

Then, I've set up the same thing on this website using AutomatorWP-- https://member.cordialmarketplace.com/

Here's the Email message that users receive --- https://prnt.sc/zLybVgVrcWK0

Then we have Services that do Birthday Automation:

See here from MailChimp-- https://mailchimp.com/help/create-an-automated-birthday-email/

and here from Engage-- https://engage.so/blog/how-to-automate-birthday-message-with-engage/

While Gamification plugins reward people with points on their Birthdays.

See here from Gamipress--- https://gamipress.com/add-ons/gamipress-birthdays/

and here from MyCred -- https://mycred.me/store/mycred-birthdays/

From all these instances, Birthday is a situation in life that is celebrated.

BuddyPress should have an Email Situation for it.

IMPLEMENTATION
When BuddyPress loads, all existing Email situations should stay active by default as they've always been.

While the Birthday Email situation should stay inactive. It should require Admin to intentionally activate it.

When Admin activates it, there should be a Popup with a scrollable list of all xprofile fields on the website.

And this Popup tells Admin "Choose a field for this event?"

Notice should be visible at the bottom, that informs Admin "choose only a Date field for this action".

Now, Admin is expected to click on a Date field he will like to use for this event. Once selected and saved, that field becomes the basis for activating the Birthday Situation Emails.

See sample of the Popup--- https://prnt.sc/jVaX5NMf9RCS

I believe you can understand things from here onwards.

Regards.

#4 @imath
12 months ago

I do 🙂.

Thanks for all these inputs. It should help contributors to suggest a patch about it.

#5 @gbordormor22
12 months ago

Someone provided me this Code:

<?php
// Add this code to your theme's functions.php file or use a custom code plugin

function wbcom_send_birthday_reminders() {
    // Get all BuddyPress members
    $bp_members = new BP_User_Query(array('per_page' => -1));

    if (!empty($bp_members->results)) {
        foreach ($bp_members->results as $member) {
            // Get the user's birthday from xProfile field
            $birthday = bp_get_profile_field_data(array('field' => 'Birthday', 'user_id' => $member->ID));

            // Check if it's the user's birthday
            if ($birthday && date('md', strtotime($birthday)) == date('md')) {
                // It's the user's birthday, send a reminder email
                $to = $member->user_email;
                $subject = 'Happy Birthday!';
                $message = 'Dear ' . $member->display_name . ',\n\nHappy Birthday!';

                // Send email
                wp_mail($to, $subject, $message);
            }
        }
    }
}

// Schedule the birthday reminder to be sent daily
add_action('init', function () {
    if (!wp_next_scheduled('wbcom_send_birthday_reminders')) {
        wp_schedule_event(time(), 'daily', 'wbcom_send_birthday_reminders');
    }
});

// Hook the function to the scheduled event
add_action('wbcom_send_birthday_reminders', 'wbcom_send_birthday_reminders');

I don't know if this can be a starting point for what I'm asking for?

Note: See TracTickets for help on using tickets.