docs(03): create phase 3 plans
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)
This commit is contained in:
215
.planning/phases/03-job-management-core/03-03-PLAN.md
Normal file
215
.planning/phases/03-job-management-core/03-03-PLAN.md
Normal file
@@ -0,0 +1,215 @@
|
||||
---
|
||||
phase: 03-job-management-core
|
||||
plan: 03
|
||||
type: execute
|
||||
depends_on: ["03-01"]
|
||||
files_modified: [includes/class-notifications.php, includes/class-ddhh-job-manager.php, ddhh-job-manager.php]
|
||||
---
|
||||
|
||||
<objective>
|
||||
Send email notification to site admin when a provider submits a new job listing for moderation.
|
||||
|
||||
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.
|
||||
</objective>
|
||||
|
||||
<execution_context>
|
||||
~/.claude/get-shit-done/workflows/execute-plan.md
|
||||
~/.claude/get-shit-done/templates/summary.md
|
||||
</execution_context>
|
||||
|
||||
<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.php
|
||||
|
||||
**Tech 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)
|
||||
</context>
|
||||
|
||||
<tasks>
|
||||
|
||||
<task type="auto">
|
||||
<name>Task 1: Create notification class with admin alert on job submission</name>
|
||||
<files>includes/class-notifications.php</files>
|
||||
<action>
|
||||
Create new file `includes/class-notifications.php` with class `DDHH_JM_Notifications`.
|
||||
|
||||
**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.
|
||||
</action>
|
||||
<verify>
|
||||
1. Class file created with proper structure
|
||||
2. Hook registered in setup_hooks() method
|
||||
3. Email sends only on new → pending transition
|
||||
4. Email includes all required fields (title, author, location, type, edit link)
|
||||
5. php -l includes/class-notifications.php (no errors)
|
||||
</verify>
|
||||
<done>
|
||||
- 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
|
||||
</done>
|
||||
</task>
|
||||
|
||||
<task type="auto">
|
||||
<name>Task 2: Integrate notifications into plugin initialization</name>
|
||||
<files>includes/class-ddhh-job-manager.php, ddhh-job-manager.php</files>
|
||||
<action>
|
||||
**File 1: ddhh-job-manager.php**
|
||||
Add require statement for notifications class:
|
||||
```php
|
||||
require_once plugin_dir_path( __FILE__ ) . 'includes/class-notifications.php';
|
||||
```
|
||||
|
||||
**File 2: includes/class-ddhh-job-manager.php**
|
||||
In the `__construct()` or initialization method, add hook for notifications:
|
||||
```php
|
||||
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.
|
||||
</action>
|
||||
<verify>
|
||||
1. Require statement added to main plugin file
|
||||
2. setup_hooks() called via init action in main class
|
||||
3. Pattern consistent with other class initializations
|
||||
4. php -l on both modified files (no errors)
|
||||
</verify>
|
||||
<done>
|
||||
- Notifications class required in main plugin file
|
||||
- Hooks initialized via init action
|
||||
- Integration consistent with existing pattern
|
||||
- No PHP syntax errors
|
||||
</done>
|
||||
</task>
|
||||
|
||||
</tasks>
|
||||
|
||||
<verification>
|
||||
Before declaring plan complete:
|
||||
- [ ] DDHH_JM_Notifications class exists
|
||||
- [ ] Hook registered on transition_post_status
|
||||
- [ ] Email sent only on new pending job submissions
|
||||
- [ ] Email includes job title, author, location, type, edit link
|
||||
- [ ] Email text in German
|
||||
- [ ] Class integrated into plugin initialization
|
||||
- [ ] No PHP syntax errors
|
||||
</verification>
|
||||
|
||||
<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>
|
||||
|
||||
<output>
|
||||
After completion, create `.planning/phases/03-job-management-core/03-03-SUMMARY.md` with:
|
||||
|
||||
---
|
||||
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
|
||||
</output>
|
||||
Reference in New Issue
Block a user