Adds an opt-in email notice sent to an instructor when someone books one of their private lessons or enrols in one of their group classes.
Off by default, per instructor. Set from My Availability → Notifications (stored as us_notify_on_booking user meta). Each instructor chooses for themselves.
Covers every path. Student/guardian self-service (REST) and studio-on-their-behalf (wp-admin), for both lessons and group classes.
Weekly reservations report how many lessons were claimed.
Courtesy only — a missing or failed send never fails a booking or enrolment.
How
Auth\InstructorNotificationPref — the per-instructor user-meta preference.
Auth\InstructorNotificationMailer — notifyLessonBooked() / notifyEnrollment(); the opt-in check and recipient resolution are centralised here so no call site can drift on who is mailed.
Trigger points:
Booking\LessonBooker::settle() — one choke point for both lesson-booking paths.
Spec: docs/features/instructor-notifications.md. Changelog entry under [1.6.1].
## What
Adds an opt-in email notice sent to an instructor when someone books one of their private lessons or enrols in one of their group classes.
- **Off by default, per instructor.** Set from **My Availability → Notifications** (stored as `us_notify_on_booking` user meta). Each instructor chooses for themselves.
- **Covers every path.** Student/guardian self-service (REST) and studio-on-their-behalf (wp-admin), for both lessons and group classes.
- **Weekly reservations** report how many lessons were claimed.
- **Courtesy only** — a missing or failed send never fails a booking or enrolment.
## How
- `Auth\InstructorNotificationPref` — the per-instructor user-meta preference.
- `Auth\InstructorNotificationMailer` — `notifyLessonBooked()` / `notifyEnrollment()`; the opt-in check and recipient resolution are centralised here so no call site can drift on who is mailed.
- Trigger points:
- `Booking\LessonBooker::settle()` — one choke point for both lesson-booking paths.
- `GroupClass\EnrollmentEndpoint::enroll()` — student/guardian enrolment.
- `GroupClass\GroupClassController::addDirect()` — studio "Add students directly".
- `Availability\AvailabilityController` + `templates/admin/availability.php` — the toggle.
New dependencies default to fresh instances, so `Plugin`/`RestRegistrar`/`AdminMenu` wiring is unchanged. No schema/migration, so no version bump needed.
## Tests
- New: `InstructorNotificationPrefTest`, `InstructorNotificationMailerTest`, plus enrolment/availability integration assertions.
- Booking-path tests inject a mock mailer, keeping them about booking.
- `phpunit` 1043 pass, `phpstan` (level 10) clean, `phpcs` clean.
Spec: `docs/features/instructor-notifications.md`. Changelog entry under `[1.6.1]`.
Add an opt-in, per-instructor email notice sent when someone books one of
their lessons or enrols in one of their group classes. Off by default and
set from My Availability → Notifications; covers both the student/guardian
REST flows and the studio's wp-admin "book/add for a student" forms.
The opt-in check lives in InstructorNotificationMailer so no booking path
can drift on who is mailed; lessons fire from LessonBooker::settle (the one
step both booking paths reach), enrolments from EnrollmentEndpoint::enroll
and GroupClassController::addDirect. The notice is a courtesy and never
fails a booking or enrolment that otherwise succeeded.
Co-authored-by: anthropic/claude-opus-4-8
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
What
Adds an opt-in email notice sent to an instructor when someone books one of their private lessons or enrols in one of their group classes.
us_notify_on_bookinguser meta). Each instructor chooses for themselves.How
Auth\InstructorNotificationPref— the per-instructor user-meta preference.Auth\InstructorNotificationMailer—notifyLessonBooked()/notifyEnrollment(); the opt-in check and recipient resolution are centralised here so no call site can drift on who is mailed.Booking\LessonBooker::settle()— one choke point for both lesson-booking paths.GroupClass\EnrollmentEndpoint::enroll()— student/guardian enrolment.GroupClass\GroupClassController::addDirect()— studio "Add students directly".Availability\AvailabilityController+templates/admin/availability.php— the toggle.New dependencies default to fresh instances, so
Plugin/RestRegistrar/AdminMenuwiring is unchanged. No schema/migration, so no version bump needed.Tests
InstructorNotificationPrefTest,InstructorNotificationMailerTest, plus enrolment/availability integration assertions.phpunit1043 pass,phpstan(level 10) clean,phpcsclean.Spec:
docs/features/instructor-notifications.md. Changelog entry under[1.6.1].