Need notifications for pending appointments

Busy medical office needs reminders to check wordpress for appointments - would like to send notifications when an appointments is scheduled and is marked pending.

Our workflow requires so payment for scheduling appointments - but we do need to manually confirm.

Found this in the forum - https://premium.wpmudev.org/forums/topic/appointments-conditional-email-notifications?replies=6#post-789716 - which may do the trick, but I need help implementing this work around.

  • Patrick

    Hi there @studiosplash

    Welcome to WPMU DEV, glad to have you aboard!

    Yup, that code should work just fine. :slight_smile:

    You simply need to paste it in the functions.php file of your active theme.

    But there is a small error in the code in that post. here it is again without the error. :slight_smile:

    function app_forward_mail( $body, $r, $app_id ) {
    if ( 'pending' == $r->status ||  'confirmed' == $r->status )
    // Enter as many emails as you wish and change Subject as required
    wp_mail( array('mail1@example.com','mail2@example.com' ), 'Subject', $body );
    }
    
    add_action( 'app_notification_sent', 'app_forward_mail', 10, 3 );

    The above will send an email to each address you specify for any appointment that is either confirmed or pending. If you need to add more email addys, separate each one with a comma as seen in the code.

    I hope this helps! And thanks for being a member :slight_smile:

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.