Follow up emails for A+

The reminder emails are such nice automation features. I am switching over from a competing third party that also offers follow up emails "x" hours or days after the completion of an appt. Is that feature on the horizon?

  • Hakan

    Hi,

    Power of A+ comes from its being a WordPress application. Therefore it is always possible to add your customization codes (Addons) without the need to modify the plugin codes themselves.

    In your case, add the following codes inside functions.php of your current theme. Change the 3 variables as required.

    function follow_up( $value ) {
    	global $wpdb, $appointments;
    
    	$a = $appointments;
    	// Double check if A+ is active
    	if ( !is_object( $a ) )
    		return;
    
    	// Follow up time in hours
    	$hour = 24;
    	// Follow up email subject
    	$subject = 'Follow up subject';
    	// Follow up email message
    	$message = 'Follow up message';
    
    	$results = $wpdb->get_results( "SELECT * FROM " . $a->app_table . " WHERE note NOT LIKE '%Follow up sent%' AND status='completed' AND DATE_ADD(start, INTERVAL ".$hour." HOUR) <'" . 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 . ' Follow up sent' ),
    							array( 'ID'		=> $r->ID ),
    							array ( '%s' )
    						);
    			}
    		}
    	}
    }
    add_action( 'update_option_app_last_update', 'follow_up' );

    Cheers,
    Hakan

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.