Skip to content
Open
Show file tree
Hide file tree
Changes from 1 commit
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
8 changes: 5 additions & 3 deletions assets/scss/admin-dashboard/_tutor-admin.scss
Original file line number Diff line number Diff line change
Expand Up @@ -2047,8 +2047,8 @@ h2.tutor-page-heading {

a {
color: #ffffff;
text-decoration: underline;
text-underline-offset: 3px;
text-decoration: underline;
text-underline-offset: 3px;

&:hover,
&:focus,
Expand All @@ -2075,14 +2075,16 @@ h2.tutor-page-heading {
}

.notice-dismiss {
box-sizing: border-box;
right: 42px;
top: 37px;
width: 40px;
height: 40px;
border: 1px solid #ffffff;
border-radius: 4px;
padding: 10px;
padding: 9px;
color: #ffffff;
text-decoration: none;

&::before {
content: '\e91e';
Expand Down
32 changes: 31 additions & 1 deletion classes/Admin.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@

add_action( 'admin_notices', array( $this, 'show_unstable_version_admin_notice' ) );
add_action( 'admin_notices', array( $this, 'show_v4_beta_notice' ) );
add_action( 'admin_init', array( $this, 'dismiss_v4_beta_notice' ) );

add_action( 'admin_menu', array( $this, 'register_menu' ) );
// Force activate menu for necessary.
Expand All @@ -60,7 +61,7 @@
// Handle flash toast message for redirect_to util helper.
add_action( 'admin_head', array( new Utils(), 'handle_flash_message' ), 999 );

add_action( 'admin_bar_menu', array( $this, 'add_toolbar_items' ), 100 );

Check failure on line 64 in classes/Admin.php

View workflow job for this annotation

GitHub Actions / phpstan

Action callback returns mixed but should not return anything.

Check failure on line 64 in classes/Admin.php

View workflow job for this annotation

GitHub Actions / phpstan

Action callback returns mixed but should not return anything.

add_action( 'wp_ajax_tutor_do_not_show_feature_page', array( $this, 'handle_do_not_show_feature_page' ) );
}
Expand Down Expand Up @@ -95,8 +96,13 @@
*/
public function show_v4_beta_notice() {
if ( version_compare( TUTOR_VERSION, '4', '<' ) ) {
$user_id = get_current_user_id();
$dismissed = get_user_meta( $user_id, 'tutor_v4_beta_notice_dismissed', true );
if ( $dismissed ) {
return;
}
?>
<div class="tutor-v4-beta-notice notice is-dismissible">
<div class="tutor-v4-beta-notice notice">
<div class="tutor-v4-beta-notice-left">
<img src="<?php echo esc_url( tutor()->url . 'assets/images/v4-notice-logo.svg' ); ?>" alt="Tutor LMS 4.0 Beta">
</div>
Expand Down Expand Up @@ -136,11 +142,35 @@
</a>
</div>
</div>
<a href="<?php echo esc_url( wp_nonce_url( add_query_arg( 'tutor_dismiss_v4_beta_notice', '1' ), 'tutor_dismiss_v4_beta_notice' ) ); ?>" class="notice-dismiss">
<span class="screen-reader-text"><?php esc_html_e( 'Dismiss this notice.', 'tutor' ); ?></span>
</a>
</div>
<?php
}
}

/**
* Persist the dismissal of the v4 beta notice for the current user.
* Triggered via a query param on any admin page, then redirects to clean the URL.
*
* @since 3.9.9
*
* @return void
*/
public function dismiss_v4_beta_notice() {
if ( ! isset( $_GET['tutor_dismiss_v4_beta_notice'] ) ) {
return;
}

Comment thread
sazedul-haque marked this conversation as resolved.
check_admin_referer( 'tutor_dismiss_v4_beta_notice' );
update_user_meta( get_current_user_id(), 'tutor_v4_beta_notice_dismissed', true );

$redirect = remove_query_arg( array( 'tutor_dismiss_v4_beta_notice', '_wpnonce' ) );
wp_safe_redirect( $redirect );
exit;
}

/**
* Register admin menus
*
Expand Down Expand Up @@ -311,7 +341,7 @@
'menu_title' => __( 'Tools', 'tutor' ),
'capability' => 'manage_tutor',
'menu_slug' => 'tutor-tools',
'callback' => array( new Tools_V2(), 'load_tools_page' ),

Check failure on line 344 in classes/Admin.php

View workflow job for this annotation

GitHub Actions / phpstan

Class Tutor\Tools_V2 referenced with incorrect case: TUTOR\Tools_V2.

Check failure on line 344 in classes/Admin.php

View workflow job for this annotation

GitHub Actions / phpstan

Class Tutor\Tools_V2 referenced with incorrect case: TUTOR\Tools_V2.
),
'settings' => array(
'parent_slug' => 'tutor',
Expand All @@ -319,7 +349,7 @@
'menu_title' => __( 'Settings', 'tutor' ),
'capability' => 'manage_tutor',
'menu_slug' => 'tutor_settings',
'callback' => array( new Options_V2(), 'load_settings_page' ),

Check failure on line 352 in classes/Admin.php

View workflow job for this annotation

GitHub Actions / phpstan

Class Tutor\Options_V2 referenced with incorrect case: TUTOR\Options_V2.

Check failure on line 352 in classes/Admin.php

View workflow job for this annotation

GitHub Actions / phpstan

Class Tutor\Options_V2 referenced with incorrect case: TUTOR\Options_V2.
),
'license' => null,
'whats_new' => null,
Expand Down Expand Up @@ -406,7 +436,7 @@
*/
public function feature_promotion_page() {
include tutor()->path . 'views/pages/welcome.php';
// include tutor()->path . 'views/pages/feature-promotion.php';

Check failure on line 439 in classes/Admin.php

View workflow job for this annotation

GitHub Actions / WPCS

Inline comments must end in full-stops, exclamation marks, or question marks
}

/**
Expand Down Expand Up @@ -571,7 +601,7 @@
* @return void
*/
public function filter_posts_for_instructors() {
if ( ! current_user_can( 'administrator' ) && current_user_can( tutor()->instructor_role ) ) {

Check failure on line 604 in classes/Admin.php

View workflow job for this annotation

GitHub Actions / WPCS

Capabilities should be used instead of roles. Found &quot;administrator&quot; in function call to current_user_can()
@remove_menu_page( 'edit-comments.php' ); // Comments.
add_filter( 'posts_clauses_request', array( $this, 'posts_clauses_request' ) );
}
Expand Down Expand Up @@ -617,7 +647,7 @@
* @return void
*/
public function check_if_current_users_post() {
if ( current_user_can( 'administrator' ) || ! current_user_can( tutor()->instructor_role ) ) {

Check failure on line 650 in classes/Admin.php

View workflow job for this annotation

GitHub Actions / WPCS

Capabilities should be used instead of roles. Found &quot;administrator&quot; in function call to current_user_can()
return;
}

Expand Down
Loading