Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- add_filter( 'app_message_headers', 'custom_headers_anv' );
- function custom_headers_anv( $message_headers ){
- $message_headers .= "Content-type:text/html;charset=UTF-8" . "\r\n";
- return $message_headers;
- }
- function annv_follow_up( $value ) {
- global $wpdb, $appointments;
- $a = $appointments;
- // Double check if A+ is active
- if ( !is_object( $a ) )
- return;
- // Follow up time in hours
- $month = 11;
- // Follow up email subject
- $subject = 'We Would Like to Hear From You!';
- // Follow up email message
- $message = '<center><img src="http://kidsclub4fun.com/newsite/wp-content/uploads/2015/05/kidsclublogo-hi-res.jpg" width="221" height="129"></center><br />
- <br />Thank you for having your party with Kids Club Fun and Fitness. We would like to see how we did! Below is a link to a survey that will let us know how our performance was.<br />
- <br />
- <a href="http://kidsclub4fun.com/birthday-party-customer-feedback/">Birthday Party Feedback</a><br />
- <br />
- Warm Regards,<br />
- Kids Club Fun and Fitness<br />
- (360)-546-5437';
- $results = $wpdb->get_results( "SELECT * FROM " . $a->app_table . " WHERE note NOT LIKE '%Follow up sent%' AND
- status='completed' AND DATE_ADD(created, INTERVAL ".$month." MONTH) <'" . date ("Y-m-d H:i:s", $a->local_time ). "' " );
- if ( $results ) {
- foreach ( $results as $r ) {
- // Send email
- if ( wp_mail( $r->email, $subject, $message, $a->message_headers() ) ) {
- // Save so that we don't send email again
- $wpdb->update ( $a->app_table,
- array( 'note' => $r->note . ' Anniversary reminder sent' ),
- array( 'ID' => $r->ID ),
- array ( '%s' )
- );
- // Log here for better results
- $appointments->log ( sprintf( "Follow up email sent to %s for appointment ID %s" , $r->email , $r->ID ) ) ;
- }
- }
- }
- }
- add_action( 'update_option_app_last_update', 'annv_follow_up' );
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement