diff --git a/php/admin/admin-results-page.php b/php/admin/admin-results-page.php index 3fda0d296..62b2c06f3 100644 --- a/php/admin/admin-results-page.php +++ b/php/admin/admin-results-page.php @@ -296,6 +296,7 @@ function qsm_results_overview_tab_content() { $user_id = get_current_user_id(); if ( isset( $_POST["results-screen_option_nonce"] ) && wp_verify_nonce( sanitize_text_field( wp_unslash( $_POST["results-screen_option_nonce"] ) ), 'results_screen_option' ) ) { $results_screen_option['page_url'] = isset( $_POST['page_url'] ) ? sanitize_text_field( wp_unslash( $_POST['page_url'] ) ) : "0"; + $results_screen_option['view_result_page'] = isset( $_POST['view_result_page'] ) ? sanitize_text_field( wp_unslash( $_POST['view_result_page'] ) ) : "0"; $results_screen_option['page_name'] = isset( $_POST['page_name'] ) ? sanitize_text_field( wp_unslash( $_POST['page_name'] ) ) : "0"; $results_screen_option['business'] = isset( $_POST['business'] ) ? sanitize_text_field( wp_unslash( $_POST['business'] ) ) : "0"; $results_screen_option['phone'] = isset( $_POST['phone'] ) ? sanitize_text_field( wp_unslash( $_POST['phone'] ) ) : "0"; @@ -307,15 +308,15 @@ function qsm_results_overview_tab_content() { } else { $results_screen_option = get_user_meta( $user_id, 'results_screen_option', true ); $results_screen_option = ! empty( $results_screen_option ) ? $results_screen_option : ''; - if ( empty( $results_screen_option ) ) { - $results_screen_option = array( - 'page_url' => '0', - 'page_name' => '0', - 'business' => '1', - 'phone' => '1', - 'ip_address' => '1', - ); - } + $default_results_screen_option = array( + 'page_url' => '0', + 'view_result_page' => '0', + 'page_name' => '0', + 'business' => '1', + 'phone' => '1', + 'ip_address' => '1', + ); + $results_screen_option = wp_parse_args( $results_screen_option, $default_results_screen_option ); if ( ! isset( $results_screen_option['start_date'] ) ) { $results_screen_option['start_date'] = "0"; } @@ -332,18 +333,19 @@ function qsm_results_overview_tab_content() { wp_nonce_field( 'bulk_delete', 'bulk_delete_nonce' ); $th_elements = apply_filters( 'mlw_qmn_admin_results_page_headings', array( - 'score' => __( 'Score', 'quiz-master-next' ), - 'time_complete' => __( 'Time To Complete', 'quiz-master-next' ), - 'name' => __( 'Name', 'quiz-master-next' ), - 'business' => __( 'Business', 'quiz-master-next' ), - 'email' => __( 'Email', 'quiz-master-next' ), - 'phone' => __( 'Phone', 'quiz-master-next' ), - 'user' => __( 'User', 'quiz-master-next' ), - 'start_date' => __( 'Start Date', 'quiz-master-next' ), - 'time_taken' => __( 'End Date', 'quiz-master-next' ), - 'ip' => __( 'IP Address', 'quiz-master-next' ), - 'page_name' => __( 'Page Name', 'quiz-master-next' ), - 'page_url' => __( 'Page URL', 'quiz-master-next' ), + 'score' => __( 'Score', 'quiz-master-next' ), + 'time_complete' => __( 'Time To Complete', 'quiz-master-next' ), + 'name' => __( 'Name', 'quiz-master-next' ), + 'business' => __( 'Business', 'quiz-master-next' ), + 'email' => __( 'Email', 'quiz-master-next' ), + 'phone' => __( 'Phone', 'quiz-master-next' ), + 'user' => __( 'User', 'quiz-master-next' ), + 'start_date' => __( 'Start Date', 'quiz-master-next' ), + 'time_taken' => __( 'End Date', 'quiz-master-next' ), + 'ip' => __( 'IP Address', 'quiz-master-next' ), + 'page_name' => __( 'Page Name', 'quiz-master-next' ), + 'page_url' => __( 'Page URL', 'quiz-master-next' ), + 'view_result_page' => __( 'Result Page', 'quiz-master-next' ), ) ); $values = $quiz_infos = []; @@ -374,6 +376,9 @@ function qsm_results_overview_tab_content() { if ( "0" === $results_screen_option['time_taken'] ) { $values['time_taken']['style'] = $display_none; } + if ( "0" === $results_screen_option['view_result_page'] ) { + $values['view_result_page']['style'] = $display_none; + } if ( ! class_exists( 'QSM_Proctoring_Quiz' ) ) { $proctor_class = "qsm-quiz-proctor-addon"; }else { @@ -480,8 +485,13 @@ function qsm_results_overview_tab_content() { } $values['page_url']['content'][] = '' . esc_html( $quiz_page_url ) . ''; } + if ( isset( $values['view_result_page']) ) { + $quiz_page_url = $mlw_quiz_info->page_url; + $unique_id = $mlw_quiz_info->unique_id; + $values['view_result_page']['content'][] = '' . esc_html__( 'View', 'quiz-master-next' ) . ''; + } foreach ( $values as $k => $v ) { - if ( ! in_array( $k, [ 'score', 'time_complete', 'name', 'business', 'email', 'phone', 'user', 'time_taken', 'ip', 'page_name', 'page_url' ], true ) ) { + if ( ! in_array( $k, [ 'score', 'time_complete', 'name', 'business', 'email', 'phone', 'user', 'time_taken', 'ip', 'page_name', 'page_url', 'view_result_page' ], true ) ) { $content = apply_filters( 'mlw_qmn_admin_results_page_column_content', '', $mlw_quiz_info, $k ); if ( isset( $values[ $k ] ) && ! empty( $content ) ) { $values[ $k ]['content'][] = $content; @@ -558,6 +568,10 @@ function qsm_results_overview_tab_content() { /> +