fix(07-01): allow providers to edit published job offers

Added edit_published_job_offers capability to ddhh_provider role and created upgrade_roles function to automatically add this capability to existing provider accounts. Providers can now edit their published job offers from the dashboard.

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
This commit is contained in:
2026-01-17 21:20:16 +09:00
parent 7f2c5fa6a6
commit 32a22e5fd6
2 changed files with 21 additions and 0 deletions

View File

@@ -28,6 +28,7 @@ class DDHH_JM_Roles {
// Job offer capabilities (own only)
'edit_job_offers' => true,
'edit_published_job_offers' => true,
'delete_job_offers' => true,
'upload_files' => true,
@@ -70,11 +71,28 @@ class DDHH_JM_Roles {
}
}
/**
* Upgrade existing roles with new capabilities
* Called on plugin init to ensure all capabilities are present
*/
public static function upgrade_roles() {
$provider_role = get_role( 'ddhh_provider' );
if ( $provider_role && ! $provider_role->has_cap( 'edit_published_job_offers' ) ) {
$provider_role->add_cap( 'edit_published_job_offers' );
}
}
/**
* Remove custom roles
* Called on plugin deactivation
*/
public static function remove_roles() {
// Remove provider role capabilities before removing role
$provider_role = get_role( 'ddhh_provider' );
if ( $provider_role ) {
$provider_role->remove_cap( 'edit_published_job_offers' );
}
remove_role( 'ddhh_provider' );
// Remove job_offer capabilities from administrator