Files
Digital-Dabei-Hamburg-Job-M…/.planning/phases/05-mentor-job-board/05-01-PLAN.md
Viktor Miller ac60de5d99 docs(05): create phase plan
Phase 05: Mentor Job Board
- 3 plans created (parallel-ready)
- 5 total tasks defined
- Ready for execution

Plans:
- 05-01: Archive access control and query setup
- 05-02: Job application form with provider notification
- 05-03: Logo auto-crop to 200x200px

All plans independent (depends_on: []), can execute in parallel.
2026-01-14 20:22:35 +09:00

116 lines
5.1 KiB
Markdown

---
phase: 05-mentor-job-board
plan: 01
type: execute
depends_on: []
files_modified: [includes/class-access-control.php, includes/class-archive.php]
---
<objective>
Protect job archive from public access and configure published jobs query for Elementor template.
Purpose: Ensure only logged-in users (mentors/subscribers) can browse jobs, while providing query setup that Elementor templates will use.
Output: Protected archive with access control, query configuration helper for Elementor.
</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/01-foundation-setup/01-02-SUMMARY.md
@.planning/phases/02-provider-registration-auth/02-04-SUMMARY.md
# Source files:
@includes/class-access-control.php
@includes/class-post-types.php
**Tech stack available:** template_redirect hook, WP_Query filters, is_user_logged_in()
**Established patterns:**
- Access control via template_redirect hook (Phase 02-04)
- Custom post type with archive slug 'jobangebote' (Phase 01-02)
- Role-based redirects to login page (Phase 02-04)
**Constraining decisions:**
- Phase 01-02: Archive slug is 'jobangebote', supports has_archive
- Phase 02-04: Access control uses template_redirect, redirects to /anbieter-login/
- PROJECT.md: Protected job archive (logged-in mentors only), Elementor Pro theme integration
</context>
<tasks>
<task type="auto">
<name>Task 1: Add archive access control to existing access control class</name>
<files>includes/class-access-control.php</files>
<action>Add method protect_job_archive() that hooks template_redirect (priority 10). Check if current page is job_offer archive (is_post_type_archive('job_offer')). If yes and user NOT logged in, redirect to /anbieter-login/ with wp_safe_redirect. Register hook in existing setup_hooks() method following established pattern from protect_provider_dashboard(). This ensures mentors (subscribers) can browse jobs but public cannot access archive.</action>
<verify>Check class-access-control.php contains protect_job_archive() method. Verify hook registered in setup_hooks(). Confirm redirect logic uses is_post_type_archive() and is_user_logged_in().</verify>
<done>Archive protection method exists, hook registered, redirect logic matches provider dashboard pattern</done>
</task>
<task type="auto">
<name>Task 2: Create archive query helper class for Elementor integration</name>
<files>includes/class-archive.php, includes/class-ddhh-job-manager.php, ddhh-job-manager.php</files>
<action>Create new includes/class-archive.php with class DDHH_JM_Archive. Add static method setup_hooks() that registers pre_get_posts filter (priority 10). In filter callback modify_archive_query($query), check if is job_offer archive AND is main query: set post_status='publish', orderby='date', order='DESC', posts_per_page=-1 (show all published jobs). This ensures Elementor Loop Grid displays only published jobs sorted by newest first. Initialize class in class-ddhh-job-manager.php following existing pattern (DDHH_JM_Notifications::setup_hooks()). Add file_exists check and require_once in main plugin file ddhh-job-manager.php following established pattern.</action>
<verify>Check includes/class-archive.php exists with DDHH_JM_Archive class. Verify pre_get_posts filter registered. Confirm query modification only affects job_offer archives. Verify class initialized in main class and required in main plugin file.</verify>
<done>Archive query class created, filter modifies only job archives to show published posts sorted by date, class properly initialized and required</done>
</task>
</tasks>
<verification>
Before declaring plan complete:
- [ ] Archive access control method exists in class-access-control.php
- [ ] Archive query helper class exists in includes/class-archive.php
- [ ] Both hooks registered (template_redirect and pre_get_posts)
- [ ] Redirect targets /anbieter-login/ for consistency
- [ ] Query modification only affects job_offer post type archives
- [ ] Classes properly initialized following established patterns
</verification>
<success_criteria>
- Archive protected from public access (redirect to login)
- Logged-in users can access /jobangebote/ archive
- Query helper ensures only published jobs shown in archive
- Jobs sorted by date (newest first)
- Elementor Loop Grid can use default archive query
</success_criteria>
<output>
After completion, create `.planning/phases/05-mentor-job-board/05-01-SUMMARY.md`:
# Phase 5 Plan 1: Archive Access Control Summary
**[Substantive one-liner - what shipped, not "phase complete"]**
## Accomplishments
- [Key outcome 1]
- [Key outcome 2]
## Files Created/Modified
- `includes/class-access-control.php` - Description
- `includes/class-archive.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 05-02 and 05-03 (independent plans).
</output>