docs(06): create Phase 6 email notifications plans
Phase 6: Email Notifications - 3 plans created - 6 total tasks defined - Parallel execution: 06-01 and 06-02 in Wave 1, 06-03 in Wave 2 - Ready for execution Plans: - 06-01: Mentor notification opt-in (2 tasks) - 06-02: Action Scheduler integration (2 tasks) - 06-03: Async batch email processing (2 tasks) Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
This commit is contained in:
115
.planning/phases/06-email-notifications/06-01-PLAN.md
Normal file
115
.planning/phases/06-email-notifications/06-01-PLAN.md
Normal file
@@ -0,0 +1,115 @@
|
||||
---
|
||||
phase: 06-email-notifications
|
||||
plan: 01
|
||||
type: execute
|
||||
depends_on: []
|
||||
files_modified: [includes/class-user-preferences.php, includes/class-ddhh-job-manager.php, ddhh-job-manager.php]
|
||||
---
|
||||
|
||||
<objective>
|
||||
Enable mentors to opt-in to email notifications for new published jobs via user profile toggle.
|
||||
|
||||
Purpose: Allow mentors (subscribers) to control whether they receive notifications when new jobs are published, respecting user preferences and avoiding unwanted emails.
|
||||
Output: User meta field for notification preference with profile UI toggle for opt-in/opt-out.
|
||||
</objective>
|
||||
|
||||
<execution_context>
|
||||
~/.claude/get-shit-done/workflows/execute-plan.md
|
||||
./summary.md
|
||||
</execution_context>
|
||||
|
||||
<context>
|
||||
@.planning/PROJECT.md
|
||||
@.planning/ROADMAP.md
|
||||
@.planning/STATE.md
|
||||
|
||||
# Prior work this plan builds on:
|
||||
@.planning/phases/03-job-management-core/03-03-SUMMARY.md
|
||||
|
||||
# Relevant context:
|
||||
PROJECT.md line 42: "Existing users: Mentors already exist as subscribers"
|
||||
PROJECT.md line 27: "Mentor opt-in notification system for new published jobs"
|
||||
|
||||
**Tech stack available:** User meta functions (get_user_meta, update_user_meta), profile hooks (show_user_profile, edit_user_profile, personal_options_update, edit_user_profile_update)
|
||||
**Established patterns:**
|
||||
- Singleton pattern for classes (Phase 01-02)
|
||||
- Static setup_hooks() method for initialization (all phases)
|
||||
- German labels for UI (Phase 01-02, 02-01, 03-01)
|
||||
- Class file loading in main plugin file (all phases)
|
||||
|
||||
**Constraining decisions:**
|
||||
- PROJECT.md: Mentors are WordPress subscribers (existing role)
|
||||
- PROJECT.md: Opt-in system (not opt-out) - users must explicitly enable notifications
|
||||
- Phase 03-03: Email notifications use wp_mail with error logging
|
||||
</context>
|
||||
|
||||
<tasks>
|
||||
|
||||
<task type="auto">
|
||||
<name>Task 1: Create user preferences class with notification opt-in meta</name>
|
||||
<files>includes/class-user-preferences.php, includes/class-ddhh-job-manager.php, ddhh-job-manager.php</files>
|
||||
<action>Create new file includes/class-user-preferences.php with class DDHH_JM_User_Preferences. Add static method setup_hooks() that registers hooks for user profile display and saving. User meta key: 'ddhh_jm_notify_new_jobs' (boolean, default false = opt-out by default). Add method show_notification_toggle() that hooks to show_user_profile and edit_user_profile (both hooks needed - one for viewing own profile, one for admin editing). Display only for users with 'subscriber' role (mentors). Use checkbox input with label "Benachrichtigungen über neue Stellenangebote erhalten" (German: "Receive notifications about new job offers"). Add method save_notification_preference() that hooks to personal_options_update and edit_user_profile_update. Sanitize input with checkbox pattern: isset($_POST['ddhh_jm_notify_new_jobs']) ? '1' : '0'. Use update_user_meta() to save. Add nonce verification for security. Initialize class in includes/class-ddhh-job-manager.php by calling DDHH_JM_User_Preferences::setup_hooks() in init_hooks(). Add require_once in main plugin file ddhh-job-manager.php following established pattern.</action>
|
||||
<verify>Check includes/class-user-preferences.php exists with DDHH_JM_User_Preferences class. Verify setup_hooks() registered for profile display and save hooks. Confirm checkbox appears on subscriber user profiles. Verify user meta saves correctly when checkbox toggled.</verify>
|
||||
<done>User preferences class created, notification opt-in checkbox appears on mentor profiles, preference saves to user meta 'ddhh_jm_notify_new_jobs', class initialized in main plugin</done>
|
||||
</task>
|
||||
|
||||
<task type="auto">
|
||||
<name>Task 2: Add helper method to query opted-in mentors</name>
|
||||
<files>includes/class-user-preferences.php</files>
|
||||
<action>Add static method get_opted_in_mentors() to DDHH_JM_User_Preferences class. Method returns array of user IDs who have opted in. Use WP_User_Query with arguments: role='subscriber' (mentors), meta_query for ddhh_jm_notify_new_jobs='1', fields='ID' (return only IDs for efficiency). Return empty array if no results. This provides clean API for Phase 06-03 to get notification recipients. Add error_log if query fails for debugging. Example usage: $mentor_ids = DDHH_JM_User_Preferences::get_opted_in_mentors(); foreach ($mentor_ids as $user_id) { /* send email */ }</action>
|
||||
<verify>Check get_opted_in_mentors() method exists. Verify it returns array of user IDs. Confirm WP_User_Query filters by subscriber role and meta value. Verify returns empty array when no opt-ins exist.</verify>
|
||||
<done>Helper method get_opted_in_mentors() exists, returns filtered list of opted-in mentor user IDs, ready for use in email batch processing</done>
|
||||
</task>
|
||||
|
||||
</tasks>
|
||||
|
||||
<verification>
|
||||
Before declaring plan complete:
|
||||
- [ ] User preferences class exists in includes/class-user-preferences.php
|
||||
- [ ] Checkbox appears on subscriber user profiles (both own profile and admin edit)
|
||||
- [ ] Preference saves correctly to user meta ddhh_jm_notify_new_jobs
|
||||
- [ ] Helper method get_opted_in_mentors() returns correct user IDs
|
||||
- [ ] Class properly initialized in main plugin
|
||||
- [ ] German labels used for UI elements
|
||||
</verification>
|
||||
|
||||
<success_criteria>
|
||||
|
||||
- User preferences class created following singleton pattern
|
||||
- Notification opt-in checkbox displayed on mentor (subscriber) profiles
|
||||
- User meta field 'ddhh_jm_notify_new_jobs' saves preference (default: false/opt-out)
|
||||
- Helper method available to query opted-in mentors by user ID
|
||||
- UI uses German labels for consistency
|
||||
- Nonce verification for security
|
||||
</success_criteria>
|
||||
|
||||
<output>
|
||||
After completion, create `.planning/phases/06-email-notifications/06-01-SUMMARY.md`:
|
||||
|
||||
# Phase 6 Plan 1: Mentor Notification Opt-In Summary
|
||||
|
||||
**[Substantive one-liner - what shipped, not "phase complete"]**
|
||||
|
||||
## Accomplishments
|
||||
|
||||
- [Key outcome 1]
|
||||
- [Key outcome 2]
|
||||
|
||||
## Files Created/Modified
|
||||
|
||||
- `includes/class-user-preferences.php` - Description
|
||||
- `includes/class-ddhh-job-manager.php` - Description
|
||||
- `ddhh-job-manager.php` - Description
|
||||
|
||||
## Decisions Made
|
||||
|
||||
[Key decisions and rationale, or "None"]
|
||||
|
||||
## Issues Encountered
|
||||
|
||||
[Problems and resolutions, or "None"]
|
||||
|
||||
## Next Step
|
||||
|
||||
Ready for parallel execution with 06-02 (Action Scheduler integration). Both 06-01 and 06-02 are independent and can run concurrently.
|
||||
</output>
|
||||
Reference in New Issue
Block a user