Phase 3: Job Management Core - 4 plans created - 8 total tasks defined - Ready for execution Plans: - 03-01: Job submission form (Formidable + ACF) - 03-02: Job edit form with ownership validation - 03-03: Admin email notification on submission - 03-04: Admin moderation UI enhancements Parallelization: - Wave 1: 03-01, 03-02, 03-04 (independent) - Wave 2: 03-03 (depends on 03-01)
6.6 KiB
phase, plan, type, depends_on, files_modified
| phase | plan | type | depends_on | files_modified | ||||
|---|---|---|---|---|---|---|---|---|
| 03-job-management-core | 03 | execute |
|
|
Purpose: Alert admins immediately when new jobs require review, ensuring timely moderation (core value: admin approval before publication). Output: Automated email notifications to admin on every new job submission.
<execution_context> ~/.claude/get-shit-done/workflows/execute-plan.md ~/.claude/get-shit-done/templates/summary.md </execution_context>
@.planning/PROJECT.md @.planning/ROADMAP.md @.planning/STATE.md @.planning/phases/01-foundation-setup/01-03-SUMMARY.md @.planning/phases/03-job-management-core/03-01-SUMMARY.md @includes/class-formidable.php @includes/class-post-types.phpTech stack available: WordPress wp_mail(), Formidable post creation hooks, job_offer CPT Established patterns: German text for user-facing content Constraining decisions:
- Jobs submit to pending status (Phase 01-03)
- Admin moderation is core value (PROJECT.md)
- Email may be disabled in Local WP dev (PROJECT.md context)
Method: send_admin_new_job_notification( $post_id )
Hook into transition_post_status action to detect when a job_offer transitions to 'pending':
- Check: $new_status === 'pending' && $old_status !== 'pending' && $post->post_type === 'job_offer'
- Avoid sending on every save - only on initial submission to pending
Email Content (German):
- To: get_option('admin_email')
- Subject: "Neues Stellenangebot zur Prüfung: {job_title}"
- Body:
Ein neues Stellenangebot wurde eingereicht und wartet auf Ihre Prüfung. Titel: {job_title} Anbieter: {author_name} ({author_organization}) Standort: {job_location} Art: {job_type} Eingereicht am: {submission_date} Prüfen Sie das Stellenangebot hier: {edit_link} --- Diese E-Mail wurde automatisch gesendet.
Email Details:
- Use wp_mail() for sending
- Headers: 'Content-Type: text/html; charset=UTF-8'
- Edit link: get_edit_post_link( $post_id, '' ) - direct admin edit URL
- Author org: get_user_meta( $post->post_author, 'ddhh_org_name', true )
- ACF fields: get_field('job_location'), get_field('job_type')
- Date: get_the_date( 'd.m.Y H:i', $post_id )
Setup method: setup_hooks()
- Hook into 'transition_post_status' with priority 10, accepts 3 params
AVOID sending emails on every post update - only initial pending submission. WHY: Prevents spam when admins save/update pending posts.
AVOID failing silently if wp_mail() fails - log errors. WHY: Email issues are common (Local WP disables email), admins need visibility.
- Class file created with proper structure
- Hook registered in setup_hooks() method
- Email sends only on new → pending transition
- Email includes all required fields (title, author, location, type, edit link)
- php -l includes/class-notifications.php (no errors)
- Notification class created
- Admin email sent on new job submission
- Email content in German with all job details
- Transition hook properly configured
- No PHP syntax errors
File 2: includes/class-ddhh-job-manager.php
In the __construct() or initialization method, add hook for notifications:
add_action( 'init', array( 'DDHH_JM_Notifications', 'setup_hooks' ) );
Pattern should match existing hook registrations (e.g., how DDHH_JM_Access_Control::setup_hooks is called from Phase 2).
AVOID hooking too early - use 'init' action for consistency with other classes. WHY: Ensures all WordPress functions (wp_mail, ACF) are available when notification runs.
- Require statement added to main plugin file
- setup_hooks() called via init action in main class
- Pattern consistent with other class initializations
- php -l on both modified files (no errors)
- Notifications class required in main plugin file
- Hooks initialized via init action
- Integration consistent with existing pattern
- No PHP syntax errors
<success_criteria>
- All tasks completed
- Admin email notification functional
- Email triggers only on new submissions (not updates)
- Email content complete and in German
- Ready for Plan 03-04 (admin UI) </success_criteria>
phase: 03-job-management-core plan: 03 subsystem: notifications tags: [email, admin-notification, wp-mail, post-transitions] requires: [03-01] provides: [admin-job-notification] affects: [] tech-stack: added: [] patterns: [transition-post-status-hook, wp-mail-notifications] key-files: created: [includes/class-notifications.php] modified: [includes/class-ddhh-job-manager.php, ddhh-job-manager.php] key-decisions:
- Used transition_post_status to detect only initial pending submissions
- Email sent to admin_email option (site admin)
- Email includes edit link for quick access to moderation issues-created: []
Phase 3 Plan 3: Admin Notifications Summary
[Substantive one-liner - what shipped]
Accomplishments
- [Key outcomes]
Files Created/Modified
includes/class-notifications.php- [description]includes/class-ddhh-job-manager.php- [description]ddhh-job-manager.php- [description]
Email Template
[Copy of actual email content sent to admin]
Decisions Made
[Implementation choices, or "None"]
Issues Encountered
[Problems and resolutions, or "None"]
Next Step
Ready for 03-04-PLAN.md (admin UI enhancements) - can run in parallel with this plan