diff --git a/template-manage-assessments.php b/template-manage-assessments.php
index 8cd144c..2dcf46a 100644
--- a/template-manage-assessments.php
+++ b/template-manage-assessments.php
@@ -8,9 +8,10 @@
*/
// Ensure the user is logged in and has the appropriate capability.
-// Using 'manage_options' as a placeholder capability for Quiz Managers.
-// Replace with a more specific capability like 'manage_quiztech_assessments' if defined.
-if ( ! is_user_logged_in() || ! current_user_can( 'manage_options' ) ) {
+// Capability required to manage assessments.
+$required_capability = 'edit_assessments'; // Corresponds to 'assessment' CPT capability_type
+
+if ( ! is_user_logged_in() || ! current_user_can( $required_capability ) ) {
// Redirect to login page or show an error message.
wp_safe_redirect( wp_login_url( get_permalink() ) );
exit;
@@ -18,6 +19,10 @@ if ( ! is_user_logged_in() || ! current_user_can( 'manage_options' ) ) {
// wp_die( esc_html__( 'You do not have sufficient permissions to access this page.', 'quiztech' ), 403 );
}
+// Get the URL for the Assessment Builder page
+$builder_page = get_page_by_path( 'assessment-builder' ); // Assuming 'assessment-builder' is the slug
+$builder_url = $builder_page ? get_permalink( $builder_page->ID ) : '';
+
get_header(); ?>
@@ -29,8 +34,53 @@ get_header(); ?>
-
-
+
+
+
+
+
+
+
+
+
+ 'assessment',
+ 'post_status' => 'publish', // Or 'any' if you want drafts etc.
+ 'posts_per_page' => -1, // Show all
+ 'orderby' => 'title',
+ 'order' => 'ASC',
+ );
+ $assessments_query = new WP_Query( $args );
+ ?>
+
+ have_posts() ) : ?>
+
diff --git a/template-manage-questions.php b/template-manage-questions.php
index e3f8fe4..009bdfc 100644
--- a/template-manage-questions.php
+++ b/template-manage-questions.php
@@ -8,9 +8,10 @@
*/
// Ensure the user is logged in and has the appropriate capability.
-// Using 'manage_options' as a placeholder capability for Quiz Managers.
-// Replace with a more specific capability like 'manage_quiztech_questions' if defined.
-if ( ! is_user_logged_in() || ! current_user_can( 'manage_options' ) ) {
+// Capability required to manage questions.
+$required_capability = 'edit_questions'; // Corresponds to 'question' CPT capability_type
+
+if ( ! is_user_logged_in() || ! current_user_can( $required_capability ) ) {
// Redirect to login page or show an error message.
wp_safe_redirect( wp_login_url( get_permalink() ) );
exit;
@@ -18,6 +19,14 @@ if ( ! is_user_logged_in() || ! current_user_can( 'manage_options' ) ) {
// wp_die( esc_html__( 'You do not have sufficient permissions to access this page.', 'quiztech' ), 403 );
}
+// Define available question types (should ideally come from a central config or helper)
+$question_types = array(
+ 'multiple-choice' => __( 'Multiple Choice', 'quiztech' ),
+ 'true-false' => __( 'True/False', 'quiztech' ),
+ 'short-answer' => __( 'Short Answer', 'quiztech' ),
+ // Add other types as needed
+);
+
get_header(); ?>