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

update change 9.2.0 #2665

Merged
merged 1 commit into from
Oct 4, 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
Binary file removed assets/Premium Bundle.png
Binary file not shown.
Binary file removed assets/Starter Bundle.png
Binary file not shown.
38 changes: 19 additions & 19 deletions mlw_quizmaster2.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
/**
* Plugin Name: Quiz And Survey Master
* Description: Easily and quickly add quizzes and surveys to your website.
* Version: 9.1.3
* Version: 9.2.0
* Author: ExpressTech
* Author URI: https://quizandsurveymaster.com/
* Plugin URI: https://expresstech.io/
Expand Down Expand Up @@ -43,7 +43,7 @@ class MLWQuizMasterNext {
* @var string
* @since 4.0.0
*/
public $version = '9.1.3';
public $version = '9.2.0';

/**
* QSM Alert Manager Object
Expand Down Expand Up @@ -703,11 +703,11 @@ public function register_quiz_post_types() {
'show_in_rest' => true,
'show_tagcloud' => false,
'rewrite' => false,
'capabilities' => array(
'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',
'delete_terms' => 'delete_qsm_quiz_categories',
'assign_terms' => 'assign_qsm_quiz_categories',
),
);
register_taxonomy( 'qsm_category', array( 'qsm-taxonomy' ), $taxonomy_args );
Expand Down Expand Up @@ -756,28 +756,28 @@ public function qsm_add_user_capabilities() {
'edit_qsm_quizzes',
'create_qsm_quizzes',
);

$user = wp_get_current_user();
$roles = (array) $user->roles;
$rolename = $roles[0];

$role = get_role( $rolename );

// Remove all capabilities first.
foreach ( $administrator_capabilities as $cap ) {
if ( $role->has_cap( $cap ) ) {
$role->remove_cap( $cap );
}
}

// Dynamically determine the capabilities to add based on the current user role.
$capabilities_to_add = isset(${$rolename . '_capabilities'}) ? ${$rolename . '_capabilities'} : array();
$capabilities_to_add = apply_filters(
'qsm_default_user_capabilities',
isset(${$rolename . '_capabilities'}) ? array_unique( array_merge( $capabilities_to_add, $contributor_capabilities ) ) : [],
$user
);

if ( isset( $capabilities_to_add ) ) {
foreach ( $capabilities_to_add as $cap ) {
$role->add_cap( $cap );
Expand Down Expand Up @@ -830,16 +830,16 @@ public function setup_admin_menu() {
$settings = (array) get_option( 'qmn-settings' );

apply_filters('qsm_user_role_menu_for_subscriber', true);
$capabilities = array(
'delete_published_qsm_quizzes',
'create_qsm_quizzes',
'delete_others_qsm_quizzes',
'manage_qsm_quiz_categories',
'manage_qsm_quiz_answer_label',
'view_qsm_quiz_result',

$capabilities = array(
'delete_published_qsm_quizzes',
'create_qsm_quizzes',
'delete_others_qsm_quizzes',
'manage_qsm_quiz_categories',
'manage_qsm_quiz_answer_label',
'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 );
add_submenu_page( 'qsm_dashboard', __( 'Dashboard', 'quiz-master-next' ), __( 'Dashboard', 'quiz-master-next' ), $capabilities[2], 'qsm_dashboard', 'qsm_generate_dashboard_page', 0 );
if ( $enabled && 'cancelled' !== $enabled ) {
Expand Down
6 changes: 3 additions & 3 deletions php/admin/admin-results-page.php
Original file line number Diff line number Diff line change
Expand Up @@ -529,11 +529,11 @@ function qsm_results_overview_tab_content() {
<div class="row-actions">
<span style="color: green; font-size: 16px;">
<?php
if ( ( current_user_can( 'view_qsm_quiz_result' ) && $quiz_infos[ $x ]->user == get_current_user_id() ) || current_user_can( 'delete_others_qsm_quizzes' ) ) {
if ( ( current_user_can( 'view_qsm_quiz_result' ) && get_current_user_id() == $quiz_infos[ $x ]->user ) || current_user_can( 'delete_others_qsm_quizzes' ) ) {
?>
<a href="admin.php?page=qsm_quiz_result_details&result_id=<?php echo esc_attr( $quiz_infos[ $x ]->result_id ); ?>"><?php esc_html_e( 'View Results', 'quiz-master-next' ); ?></a> |
<a href="admin.php?page=qsm_quiz_result_details&result_id=<?php echo esc_attr( $quiz_infos[ $x ]->result_id ); ?>"><?php esc_html_e( 'View Results', 'quiz-master-next' ); ?></a> |
<?php } ?>
<a style="color: red;" class="delete_table_quiz_results_item" data-quiz-id="<?php echo esc_attr( $quiz_infos[ $x ]->result_id ); ?>" data-quiz-name="<?php echo esc_attr( $quiz_infos[ $x ]->quiz_name ); ?>" href='#'><?php esc_html_e( 'Delete', 'quiz-master-next' ); ?></a> |
<a style="color: red;" class="delete_table_quiz_results_item" data-quiz-id="<?php echo esc_attr( $quiz_infos[ $x ]->result_id ); ?>" data-quiz-name="<?php echo esc_attr( $quiz_infos[ $x ]->quiz_name ); ?>" href='#'><?php esc_html_e( 'Delete', 'quiz-master-next' ); ?></a> |
<a class="<?php echo esc_attr( $quiz_infos[ $x ]->proctor_report_class ); ?>" href='<?php echo esc_attr( $quiz_infos[ $x ]->proctor_report_link ); ?>'><?php esc_html_e( 'Proctor Reports', 'quiz-master-next' ); ?></a>
</span>
</div>
Expand Down
8 changes: 4 additions & 4 deletions php/admin/quizzes-page.php
Original file line number Diff line number Diff line change
Expand Up @@ -180,16 +180,16 @@ public function qsm_post_row_actions( $actions, $post ) {
$quiz_id = get_post_meta( $post->ID, 'quiz_id', true );
if ( ! empty( $quiz_id ) ) {
$actions = array();
if ( ( current_user_can( 'edit_qsm_quiz', $post->ID ) && $post->post_author == get_current_user_id() ) || current_user_can( 'edit_others_qsm_quizzes' ) ) {
if ( ( current_user_can( 'edit_qsm_quiz', $post->ID ) && get_current_user_id() == $post->post_author ) || current_user_can( 'edit_others_qsm_quizzes' ) ) {
$actions['edit'] = '<a class="qsm-action-link" href="admin.php?page=mlw_quiz_options&quiz_id=' . esc_attr( $quiz_id ) . '">' . esc_html__( 'Edit', 'quiz-master-next' ) . '</a>';
}
if ( ( current_user_can( 'duplicate_qsm_quiz', $post->ID ) && $post->post_author == get_current_user_id() ) || current_user_can( 'edit_others_qsm_quizzes' ) ) {
if ( ( current_user_can( 'duplicate_qsm_quiz', $post->ID ) && get_current_user_id() == $post->post_author ) || current_user_can( 'edit_others_qsm_quizzes' ) ) {
$actions['duplicate'] = '<a class="qsm-action-link qsm-action-link-duplicate" href="#" data-id="' . esc_attr( $quiz_id ) . '">' . esc_html__( 'Duplicate', 'quiz-master-next' ) . '</a>';
}
if ( ( current_user_can( 'delete_qsm_quiz', $post->ID ) && $post->post_author == get_current_user_id() ) || current_user_can( 'delete_others_qsm_quizzes' ) ) {
if ( ( current_user_can( 'delete_qsm_quiz', $post->ID ) && get_current_user_id() == $post->post_author ) || current_user_can( 'delete_others_qsm_quizzes' ) ) {
$actions['delete'] = '<a class="qsm-action-link qsm-action-link-delete" href="#" data-id="' . esc_attr( $quiz_id ) . '" data-name="' . esc_attr( $post->post_title ) . '">' . esc_html__( 'Delete', 'quiz-master-next' ) . '</a>';
}
if ( ( current_user_can( 'view_qsm_quiz_result' ) && $post->post_author == get_current_user_id() ) || current_user_can( 'edit_others_qsm_quizzes' ) ) {
if ( ( current_user_can( 'view_qsm_quiz_result' ) && get_current_user_id() == $post->post_author ) || current_user_can( 'edit_others_qsm_quizzes' ) ) {
$actions['view_result'] = '<a class="qsm-action-link" href="admin.php?page=mlw_quiz_results&quiz_id=' . esc_attr( $quiz_id ) . '">' . esc_html__( 'View Results', 'quiz-master-next' ) . '</a>';
}
if ( empty( $settings['disable_quiz_public_link'] ) ) {
Expand Down
8 changes: 4 additions & 4 deletions php/classes/class-qsm-settings.php
Original file line number Diff line number Diff line change
Expand Up @@ -471,10 +471,10 @@ public function get_quiz_options() {
}

$text = $this->get_setting('quiz_text');
if (is_array($text)) {
foreach ($text as $key => $value) {
if (!empty($value)) {
$quiz_options[$key] = $value;
if ( is_array($text) ) {
foreach ( $text as $key => $value ) {
if ( ! empty($value) ) {
$quiz_options[ $key ] = $value;
}
}
}
Expand Down
10 changes: 9 additions & 1 deletion readme.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ Tags: quiz, survey, test, exam, online assessment
Requires at least: 4.9
Tested up to: 6.6
Requires PHP: 5.4
Stable tag: 9.1.3
Stable tag: 9.2.0
License: GPLv2
License URI: http://www.gnu.org/licenses/gpl-2.0.html

Expand Down Expand Up @@ -189,6 +189,14 @@ QSM is designed to be compatible with most WordPress plugins and themes. However
18. Database

== Changelog ==
= 9.2.0 ( October 04, 2024 ) =
* Feature: Added an option to link a question to multiple quizzes
* Bug: Resolved HTML tag issue with the %USER_ANSWER% variable
* Bug: Fixed the issue with contact form position settings
* Bug: Resolved warning issue in the %TIME_FINISHED% variable
* Enhancement: Optimized performance for random question logic
* Enhancement: Improved user permissions and added additional security checks

= 9.1.3 ( September 12, 2024 ) =
* Feature: Added placeholder customization for short answer and paragraph questions
* Bug: Resolved vulnerability issue with question settings
Expand Down
Loading