diff --git a/classes/LBRY_Admin.php b/classes/LBRY_Admin.php index 0dc2565..82ffd32 100644 --- a/classes/LBRY_Admin.php +++ b/classes/LBRY_Admin.php @@ -4,6 +4,7 @@ * * @package LBRYPress */ +defined('ABSPATH') || die(); // Exit if accessed directly class LBRY_Admin { @@ -25,13 +26,14 @@ class LBRY_Admin */ public function create_options_page() { + add_menu_page( __( 'LBRYPress Settings', 'lbrypress' ), __( 'LBRYPress', 'lbrypress' ), 'manage_options', LBRY_ADMIN_PAGE, array( $this, 'options_page_html' ), - plugin_dir_url(LBRY_PLUGIN_FILE) . '/admin/images/lbry-logo.svg' + plugin_dir_url( LBRY_PLUGIN_FILE ) . '/admin/images/lbry-icon.png' ); // Admin stylesheet enqueue @@ -48,6 +50,20 @@ class LBRY_Admin } } add_action( 'admin_enqueue_scripts', 'load_admin_stylesheet' ); + + // Admin Error Notices + function lbry_plugin_not_configured_notice() { + echo "

LBRYPress plugin is not configured yet. Please do it now.

\n"; + } + $lbry_wallet = get_option('lbry_wallet'); + if ( ! isset($lbry_wallet) ) { + add_action( 'admin_notices', 'lbry_plugin_not_configured_notice' ); + } + function admin_permission_check() { + if ( ! current_user_can( 'manage_options' ) ) { + wp_die( __( 'You do not have sufficient permissions to access this page.' ) ); + } + } } /** @@ -267,7 +283,7 @@ class LBRY_Admin $address = LBRY()->daemon->address_list(); $address = is_array( $address ) && ! empty( $address ) ? $address[0]->address : ''; printf( - '', + '', LBRY_WALLET, LBRY_SETTINGS, $address