Tasks completed: 2/2 - Register ddhh_provider role with restricted capabilities - Register ACF field group for job_offer metadata SUMMARY: .planning/phases/01-foundation-setup/01-03-SUMMARY.md
4.8 KiB
phase, plan, subsystem, tags, requires, provides, affects, tech-stack, key-files, key-decisions, issues-created, metrics
| phase | plan | subsystem | tags | requires | provides | affects | tech-stack | key-files | key-decisions | issues-created | metrics | |||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 01-foundation-setup | 03 | auth |
|
|
|
|
|
|
|
|
Phase 1 Plan 3: Roles & Fields Summary
Provider role and ACF field group for job metadata registered
Accomplishments
- Custom role 'ddhh_provider' (Anbieter) with job-only capabilities
- ACF field group 'Job Details' with 6 metadata fields
- Proper capability restrictions (no posts/pages access, no publishing)
- Logo upload support via upload_files capability
- Role registration integrated with plugin activation/deactivation
Files Created/Modified
Created:
includes/class-roles.php- Role registration and cleanup (DDHH_JM_Roles class)includes/class-acf-fields.php- ACF field group definition (DDHH_JM_ACF_Fields class)
Modified:
includes/class-activator.php- Added DDHH_JM_Roles::add_roles() callincludes/class-deactivator.php- Added DDHH_JM_Roles::remove_roles() callincludes/class-ddhh-job-manager.php- Hooked ACF fields to 'acf/init' action
Technical Details
Provider Role Capabilities
The ddhh_provider role has been configured with restricted capabilities:
Granted:
read- Basic WordPress accessedit_job_offers- Can edit own job offersdelete_job_offers- Can delete own job offersupload_files- Required for logo uploads
Explicitly Denied:
publish_job_offers- Jobs go to pending for admin approvaledit_others_job_offers- Cannot edit others' jobsedit_posts,edit_pages- No access to regular contentmanage_categories,manage_options- No admin functions
ACF Fields Structure
Field group targets post_type == 'job_offer':
- job_location (text, required) - Standort
- job_type (select, required) - Art
- Choices: Vollzeit, Teilzeit, Ehrenamt
- job_deadline (date_picker, optional) - Bewerbungsfrist
- Return format: Y-m-d
- Display format: d.m.Y (German)
- job_contact_email (email, required) - Kontakt-E-Mail
- job_logo (image, optional) - Logo
- Return format: id (attachment ID)
- Preview size: thumbnail
- job_deactivation_reason (textarea, optional) - Deaktivierungsgrund (intern)
- Conditional logic: Only shows when post_status != 'publish'
- For admin use when deactivating jobs
Decisions Made
-
Jobs submit to pending status - Providers cannot publish directly (
publish_job_offers: false). This enforces admin approval workflow as specified in PROJECT.md core value. -
German field labels - Per PROJECT.md: German only for v1. Labels use German terms: Standort, Art, Bewerbungsfrist, Kontakt-E-Mail, Logo.
-
Logo as image ID (not URL) - Using
return_format: 'id'for better media library integration. Allows access to all image sizes and metadata. -
Deactivation reason field conditional - Uses ACF conditional logic to show
job_deactivation_reasononly when post is not published. Keeps admin interface clean for active jobs. -
Capability-based isolation - Used custom capability_type 'job_offer' (from 01-02) combined with explicit denials to ensure providers cannot access posts/pages even if WordPress roles are modified.
Commits
- Task 1:
79b1389- feat(01-03): register ddhh_provider role with restricted capabilities - Task 2:
c8fdf39- feat(01-03): register ACF field group for job_offer metadata
Verification
All verification criteria met:
- Provider role exists with correct capabilities
- Provider CANNOT edit regular posts/pages (edit_posts: false, edit_pages: false)
- Provider CAN upload files (upload_files: true) for logos
- ACF fields will appear on job_offer edit screen (hooked to acf/init)
- Required fields marked as required (job_location, job_type, job_contact_email)
Issues Encountered
None
Next Phase Readiness
Phase 1 complete - all 3 plans done:
- 01-01: Plugin foundation (completed)
- 01-02: Custom post type 'job_offer' (completed)
- 01-03: Roles & ACF fields (completed)
Ready for Phase 2: Form submission with Formidable Forms. The foundation is in place:
- Custom post type registered with correct capabilities
- Provider role ready for assignment
- ACF fields ready to receive data from form submissions
No blockers or concerns.
Next Step
Phase 1 complete. Ready for Phase 2 (Form Submission).