Ok folks so here is my current process;
Vistor to the website goes to the appointment page and makes an appointment, the appointment is always free (no payment gateway) and the booking shows up in the admin with No service provider allocated with status as Pending.
I as admin then allocate the service provider in the admin area and leave the status as pending and save changes. (At this point I want it to send an email to the Service Provider Only which has the details of the send_confirmation email $body but with a different subject field to that set in the admin area settings)
The service provider then visits the site, logs into the front end and from the front end Confirms the appointment changing the status automatically to confirmed and the send_confirmation function is then called and sends the customer details of the appointment now that it is confirmed. (This already happens however it duplicates the email to the service provider again)
What code do I need to add to the appointments.php to achieve the first bit of just sending the send_confirmation email to the service provider only when they are allocated the appointment from the admin and that change is saved?
Secondly - what code do I need to remove to prevent the duplicate email being sent to the service provider when they have confirmed the booking as they do not need this second email?
I do not want the send_notification to be used as it does not contain the details of the appointment, hence choosing the send_confirmation template on both occasions.
So three stages;
Appointment made by customer: Front End: Appointment not allocated to a service provider and remains in status Pending
Admin then allocate to service provider in the admin area leaving status as pending
Service provider then confirms the appointment front end changing status to confirmed.