celebration birthday
-
Hello, Can you tell me if the following script is correct because I tried it but it does not work, thank you very much
function um_080822_email_notifications( $notifications ){ $notifications['um_greet_todays_birthdays'] = array( 'key' => 'um_greet_todays_birthdays', 'title' => __( 'Happy Birthday!','um-groups' ), 'subject' => 'Happy Birthday from {site_name}', 'body' => 'Hi {display_name},<br /><br />'. '"We wish you a happy birthday!', 'description' => __('Whether to send the user an email when someone\'s todays birthday.','ultimate-member'), 'recipient' => 'member', 'default_active' => true ); return $notifications; } add_filter( 'um_email_notifications', 'um_080822_email_notifications', 10, 1 ); function um_080822_cron_task_birthday_greet_notification(){ $date = date("/m/d"); $query_args['meta_query'][ ] = array( 'relation' => 'AND', array( 'key' => 'birth_date_45','birth_date_45-31', 'value' => $date, 'compare' => 'RLIKE' ), array( 'key' => 'um_birthday_greeted_' . md5( $date ), 'compare' => 'NOT EXISTS' ) ); $users = new WP_User_Query( $query_args ); // Get the results $celebrants = $wp_user_query->get_results(); // Check for results if ( !empty( $celebrants ) ) { foreach( $celebrants as $c ){ $recipient_email = $c->user_email; $display_name = um_user("display_name"); UM()->mail()->send( $recipient_email, 'um_greet_todays_birthdays', array( 'plain_text' => 1, 'tags' => array( '{display_name}', ), 'tags_replace' => array( $display_name, ) ) ); update_user_meta( $c->ID, 'um_birthday_greeted_' . md5( $date ), true ); } } } add_action("um_do2_birthday_greet_notification","um_080822_cron_task_birthday_greet_notification"); if ( ! wp_next_scheduled ( 'um_do2_birthday_greet_notification') ) { wp_schedule_event( time(), 'hourly', 'um_do2_birthday_greet_notification' ); }
Viewing 6 replies - 1 through 6 (of 6 total)
Viewing 6 replies - 1 through 6 (of 6 total)
- The topic ‘celebration birthday’ is closed to new replies.