feat(05-01): add job archive access control
Protect job archive from public access by redirecting non-logged-in users to /anbieter-login/. Only authenticated users (mentors/subscribers) can browse the /jobangebote/ archive. Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -24,6 +24,9 @@ class DDHH_JM_Access_Control {
|
|||||||
|
|
||||||
// Protect dashboard page (logged-in providers only)
|
// Protect dashboard page (logged-in providers only)
|
||||||
add_action( 'template_redirect', array( __CLASS__, 'protect_dashboard' ) );
|
add_action( 'template_redirect', array( __CLASS__, 'protect_dashboard' ) );
|
||||||
|
|
||||||
|
// Protect job archive (logged-in users only)
|
||||||
|
add_action( 'template_redirect', array( __CLASS__, 'protect_job_archive' ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -116,4 +119,22 @@ class DDHH_JM_Access_Control {
|
|||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Protect job archive (logged-in users only)
|
||||||
|
*/
|
||||||
|
public static function protect_job_archive() {
|
||||||
|
// Check if current page is job_offer archive
|
||||||
|
if ( ! is_post_type_archive( 'job_offer' ) ) {
|
||||||
|
return; // Not job archive
|
||||||
|
}
|
||||||
|
|
||||||
|
// Check if user is logged in
|
||||||
|
if ( ! is_user_logged_in() ) {
|
||||||
|
// Redirect to provider login page
|
||||||
|
$login_url = home_url( '/anbieter-login/' );
|
||||||
|
wp_safe_redirect( $login_url );
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user