Skip to content

Commit

Permalink
Merge pull request #2652 from QuizandSurveyMaster/dev-zubair
Browse files Browse the repository at this point in the history
added filter hook to update max and min points
  • Loading branch information
zubairraeen authored Sep 26, 2024
2 parents 364acf7 + 6c2bf39 commit 76a4951
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 22 deletions.
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

0 comments on commit 76a4951

Please sign in to comment.