docs(02): create phase 2 plans

Phase 02: Provider Registration & Auth
- 4 plans created
- 8 total tasks defined
- Ready for execution

Plans:
- 02-01: Formidable registration form with auto-login
- 02-02: Combined login/registration page
- 02-03: Provider dashboard template
- 02-04: Access control and redirects
This commit is contained in:
2026-01-14 19:12:07 +09:00
parent fecb654b82
commit 054adb721a
4 changed files with 564 additions and 0 deletions

View File

@@ -0,0 +1,141 @@
---
phase: 02-provider-registration-auth
plan: 01
type: execute
depends_on: []
files_modified: [includes/class-formidable.php]
---
<objective>
Create Formidable Forms registration form with auto-login and provider role assignment.
Purpose: Enable external organizations to self-register as providers without admin intervention.
Output: Working registration form (F1) that creates WordPress users with ddhh_provider role and logs them in automatically.
</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
@.planning/phases/01-foundation-setup/01-03-SUMMARY.md
**From Phase 1:**
- Provider role `ddhh_provider` exists with capabilities: read, edit_job_offers, delete_job_offers, upload_files
- Role explicitly denies: publish_job_offers, edit_others_job_offers, edit_posts, edit_pages
- German UI required (v1)
**Tech stack:** Formidable Forms Pro with Registration Add-on available
</context>
<tasks>
<task type="auto">
<name>Task 1: Create Formidable registration form</name>
<files>N/A (Formidable forms stored in WP database)</files>
<action>
Create Formidable form via WordPress admin:
- Form name: "Provider Registration" (Anbieter-Registrierung)
- Fields (all required):
1. organization_name (text) - Label: "Organisationsname"
2. contact_person (text) - Label: "Ansprechperson"
3. email (email) - Label: "E-Mail"
4. password (password) - Label: "Passwort"
5. password_confirm (password) - Label: "Passwort bestätigen"
- German field labels per PROJECT.md
- Email field: unique validation (WordPress user_email must be unique)
- Password fields: min 8 characters, must match
Create helper class `includes/class-formidable.php` with static method get_registration_form_id() that returns the form ID (for use in shortcodes).
DO NOT use Formidable's default English labels - all labels must be German.
</action>
<verify>Form appears in Formidable Forms list, fields have German labels, email validation set to unique</verify>
<done>Registration form created with 5 fields, all required, German labels, email uniqueness enforced</done>
</task>
<task type="auto">
<name>Task 2: Configure auto-login and role assignment</name>
<files>includes/class-formidable.php</files>
<action>
In class-formidable.php, create static method setup_registration_hooks():
Hook into Formidable's `frm_after_create_entry` action:
- Check if form_id matches registration form
- Extract email and password from entry
- Create WordPress user with wp_insert_user():
- user_login: email prefix (before @)
- user_email: email from form
- user_pass: password from form
- role: 'ddhh_provider' (from Phase 1)
- display_name: contact_person from form
- Store organization_name as user meta 'ddhh_org_name'
- Auto-login user with wp_set_auth_cookie($user_id, true)
- Prevent duplicate submissions: check if email exists before creating user
Hook this to 'init' action in main class.
DO NOT assign 'subscriber' role - only 'ddhh_provider' role from Phase 1.
DO NOT send WordPress default registration email - providers should be logged in immediately.
</action>
<verify>Create test user via form, check user appears in WP users with ddhh_provider role, auto-login occurs (user is logged in after submission)</verify>
<done>Form submission creates user with ddhh_provider role, auto-logs in user, stores org name as meta, no duplicate users created</done>
</task>
</tasks>
<verification>
Before declaring plan complete:
- [ ] Registration form exists in Formidable with German labels
- [ ] Email field enforces uniqueness
- [ ] Form submission creates WordPress user with ddhh_provider role
- [ ] User is automatically logged in after registration
- [ ] Organization name stored as user meta
- [ ] No duplicate users created on re-submission
</verification>
<success_criteria>
- All tasks completed
- Form functional and creates users
- Auto-login works
- Role assignment correct (ddhh_provider)
- Ready for 02-02 (registration page integration)
</success_criteria>
<output>
After completion, create `.planning/phases/02-provider-registration-auth/02-01-SUMMARY.md`:
# Phase 2 Plan 1: Provider Registration Form Summary
**Formidable registration form with auto-login and provider role assignment**
## Accomplishments
- Registration form with 5 fields (German labels)
- Email uniqueness validation
- Auto-login after successful registration
- ddhh_provider role assignment
- Organization name storage in user meta
## Files Created/Modified
- Form created in WordPress database (Formidable)
- `includes/class-formidable.php` - Registration hooks and user creation
## Decisions Made
[Document any implementation choices or deviations]
## Issues Encountered
[Problems and resolutions, or "None"]
## Next Step
Ready for 02-02-PLAN.md (can run in parallel with 02-03)
</output>