From fe96771a1b85a13aea42b72ca3551253307b35fc Mon Sep 17 00:00:00 2001 From: PranavAwasthi Date: Tue, 1 Oct 2024 13:10:21 +0530 Subject: [PATCH] Modify permissions for Editor role --- mlw_quizmaster2.php | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/mlw_quizmaster2.php b/mlw_quizmaster2.php index d9427197..79a38396 100644 --- a/mlw_quizmaster2.php +++ b/mlw_quizmaster2.php @@ -672,8 +672,6 @@ public function register_quiz_post_types() { 'edit_private_posts' => 'edit_private_qsm_quizzes', 'edit_published_posts' => 'edit_published_qsm_quizzes', 'create_posts' => 'create_qsm_quizzes', - 'manage_categories' => 'manage_qsm_quiz_categories', - 'manage_categories' => 'manage_qsm_quiz_answer_label', 'moderate_comments' => 'view_qsm_quiz_result', ); @@ -705,6 +703,12 @@ public function register_quiz_post_types() { 'show_in_rest' => true, 'show_tagcloud' => false, 'rewrite' => false, + 'capabilities' => array( + 'manage_terms' => 'manage_qsm_quiz_categories', + 'edit_terms' => 'edit_qsm_quiz_categories', + 'delete_terms' => 'delete_qsm_quiz_categories', + 'assign_terms' => 'assign_qsm_quiz_categories', + ), ); register_taxonomy( 'qsm_category', array( 'qsm-taxonomy' ), $taxonomy_args ); } @@ -725,16 +729,22 @@ public function qsm_add_user_capabilities() { 'manage_qsm_quiz_categories', 'manage_qsm_quiz_answer_label', 'view_qsm_quiz_result', + 'edit_qsm_quiz_categories', + 'assign_qsm_quiz_categories', + 'delete_qsm_quiz_categories', ); $editor_capabilities = array( 'publish_qsm_quizzes', 'edit_published_qsm_quizzes', + 'edit_others_qsm_quizzes', 'delete_published_qsm_quizzes', 'delete_qsm_quiz', 'delete_qsm_quizzes', 'manage_qsm_quiz_categories', 'manage_qsm_quiz_answer_label', 'view_qsm_quiz_result', + 'edit_qsm_quiz_categories', + 'assign_qsm_quiz_categories', ); $author_capabilities = array( 'edit_published_qsm_quizzes',