Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

added filter hook to update max and min points #2652

Merged
merged 1 commit into from
Sep 26, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
38 changes: 19 additions & 19 deletions mlw_quizmaster2.php
Original file line number Diff line number Diff line change
Expand Up @@ -657,24 +657,24 @@ public function register_quiz_post_types() {
'map_meta_cap' => true,
);
$quiz_args['capabilities'] = array(
'edit_post' => 'edit_qsm_quiz',
'edit_post' => 'duplicate_qsm_quiz',
'read_post' => 'read_qsm_quiz',
'delete_post' => 'delete_qsm_quiz',
'edit_posts' => 'edit_qsm_quizzes',
'edit_others_posts' => 'edit_others_qsm_quizzes',
'publish_posts' => 'publish_qsm_quizzes',
'read_private_posts' => 'read_private_qsm_quizzes',
'delete_posts' => 'delete_qsm_quizzes',
'delete_private_posts' => 'delete_private_qsm_quizzes',
'delete_published_posts'=> 'delete_published_qsm_quizzes',
'delete_others_posts' => 'delete_others_qsm_quizzes',
'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',
'edit_post' => 'edit_qsm_quiz',
'edit_post' => 'duplicate_qsm_quiz',
'read_post' => 'read_qsm_quiz',
'delete_post' => 'delete_qsm_quiz',
'edit_posts' => 'edit_qsm_quizzes',
'edit_others_posts' => 'edit_others_qsm_quizzes',
'publish_posts' => 'publish_qsm_quizzes',
'read_private_posts' => 'read_private_qsm_quizzes',
'delete_posts' => 'delete_qsm_quizzes',
'delete_private_posts' => 'delete_private_qsm_quizzes',
'delete_published_posts' => 'delete_published_qsm_quizzes',
'delete_others_posts' => 'delete_others_qsm_quizzes',
'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',
);

// Registers post type.
Expand Down Expand Up @@ -825,7 +825,7 @@ public function setup_admin_menu() {
'delete_others_qsm_quizzes',
'manage_qsm_quiz_categories',
'manage_qsm_quiz_answer_label',
'view_qsm_quiz_result'
'view_qsm_quiz_result',
);

add_menu_page( 'Quiz And Survey Master', __( 'QSM', 'quiz-master-next' ), $capabilities[1], 'qsm_dashboard', 'qsm_generate_dashboard_page', 'dashicons-feedback', $menu_position );
Expand Down
6 changes: 3 additions & 3 deletions php/classes/class-qmn-quiz-manager.php
Original file line number Diff line number Diff line change
Expand Up @@ -2566,7 +2566,7 @@ public static function qsm_max_min_points( $options, $question ) {
$question_required = ( 0 === maybe_unserialize( $question['question_settings'] )['required'] );
$multi_response = ( '4' === $question_type || '10' === $question_type || '14' === $question_type );

return self::qsm_max_min_points_conditions( $max_value_array, $min_value_array, $question_required, $multi_response );
return self::qsm_max_min_points_conditions( $max_value_array, $min_value_array, $question_required, $multi_response, $question );

}
/**
Expand All @@ -2579,7 +2579,7 @@ public static function qsm_max_min_points( $options, $question ) {
* @param array $multi_response
* @return string $max_min_result
*/
public static function qsm_max_min_points_conditions( $max_value_array, $min_value_array, $question_required, $multi_response ) {
public static function qsm_max_min_points_conditions( $max_value_array, $min_value_array, $question_required, $multi_response, $question ) {
$max_min_result = array(
'max_point' => 0,
'min_point' => 0,
Expand Down Expand Up @@ -2627,7 +2627,7 @@ public static function qsm_max_min_points_conditions( $max_value_array, $min_val
$max_min_result['max_point'] = max( $max_value_array );
$max_min_result['min_point'] = min( $min_value_array );
}
return $max_min_result;
return apply_filters( 'qsm_max_min_points_conditions_result', $max_min_result, $question_required, $question );
}

/**
Expand Down
Loading