// 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');