diff --git a/includes/admin/class-sp-admin-notices.php b/includes/admin/class-sp-admin-notices.php index 4b808db4..d747e126 100644 --- a/includes/admin/class-sp-admin-notices.php +++ b/includes/admin/class-sp-admin-notices.php @@ -5,7 +5,7 @@ * @author ThemeBoy * @category Admin * @package SportsPress/Admin - * @version 1.6.1 + * @version 2.0.9 */ if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly @@ -45,6 +45,13 @@ class SP_Admin_Notices { add_action( 'admin_notices', array( $this, 'install_notice' ) ); } + if ( 'post' == $screen->base ) { + $post_id = get_the_ID(); + if ( ! apply_filters( 'sportspress_user_can', current_user_can( 'edit_post', $post_id ), $post_id ) ) { + add_action( 'admin_notices', array( $this, 'no_access_notice' ) ); + } + } + if ( ! empty( $_GET['hide_theme_support_notice'] ) ) { $notices = array_diff( $notices, array( 'theme_support' ) ); update_option( 'sportspress_admin_notices', $notices ); @@ -77,6 +84,13 @@ class SP_Admin_Notices { include( 'views/html-notice-install.php' ); } + /** + * Displays a notice when the user doesn't have access to edit a post type + */ + public function no_access_notice() { + include( 'views/html-notice-no-access.php' ); + } + /** * Show the Theme Check notice */ diff --git a/includes/admin/views/html-notice-no-access.php b/includes/admin/views/html-notice-no-access.php new file mode 100644 index 00000000..8137891e --- /dev/null +++ b/includes/admin/views/html-notice-no-access.php @@ -0,0 +1,6 @@ + +
+

+
\ No newline at end of file