| @@ -48,16 +48,20 @@ | ||
| 48 | 48 | return $footer_text; |
| 49 | 49 | } |
| 50 | 50 | |
| 51 | 51 | public static function add_admin_page(): void { |
| 52 | + if ( ! WPCoder::user_can_manage() ) { | |
| 53 | + return; | |
| 54 | + } | |
| 55 | + | |
| 52 | 56 | $icon = 'data:image/svg+xml;base64,' . base64_encode( self::icon() ); |
| 53 | 57 | $parent = 'wp-coder'; |
| 54 | 58 | $title = WPCoder::info( 'name' ) . ' version ' . WPCoder::info( 'version' ); |
| 55 | 59 | $menu_title = 'All Codes'; |
| 56 | - $capability = 'unfiltered_html'; | |
| 60 | + $capability = WPCoder::CAPABILITY; | |
| 57 | 61 | $slug = WPCoder::SLUG; |
| 58 | 62 | |
| 59 | - add_menu_page( 'WP Coder Pro', 'WP Coder', 'unfiltered_html', $slug, [ __CLASS__, 'plugin_page' ], $icon ); | |
| 63 | + add_menu_page( 'WP Coder Pro', 'WP Coder', $capability, $slug, [ __CLASS__, 'plugin_page' ], $icon ); | |
| 60 | 64 | |
| 61 | 65 | add_submenu_page( $slug, $title, $menu_title, $capability, $slug, [ __CLASS__, 'plugin_page' ] ); |
| 62 | 66 | |
| 63 | 67 | add_submenu_page( $slug, $title, 'Add new', $capability, $slug . '-settings', [ __CLASS__, 'settings' ] ); |