diff --git a/admin/settings.php b/admin/settings.php index 88e3bcc..67f1ee4 100644 --- a/admin/settings.php +++ b/admin/settings.php @@ -253,51 +253,13 @@ function wpa_superstar_ajax_get_theme() { if (!current_user_can('install_themes')) { error_log('WPA Superstar: User does not have permission to install themes'); - wp_die(-1); + wp_send_json_error('Permission denied'); + return; } error_log('WPA Superstar: Starting theme fetch process'); try { - // Make sure required files are loaded in the correct order - if (!class_exists('WP_List_Table')) { - error_log('WPA Superstar: Loading list table base class'); - require_once ABSPATH . 'wp-admin/includes/class-wp-list-table.php'; - } - - if (!class_exists('WP_Themes_List_Table')) { - error_log('WPA Superstar: Loading themes list table class'); - require_once ABSPATH . 'wp-admin/includes/class-wp-themes-list-table.php'; - } - - if (!class_exists('WP_Theme_Install_List_Table')) { - error_log('WPA Superstar: Loading theme install list table class'); - require_once ABSPATH . 'wp-admin/includes/class-wp-theme-install-list-table.php'; - } - - if (!function_exists('themes_api')) { - error_log('WPA Superstar: Loading theme.php'); - require_once ABSPATH . 'wp-admin/includes/theme.php'; - } - - // Set up the necessary globals and requests - $GLOBALS['tab'] = 'theme-install'; - $_REQUEST['tab'] = 'theme-install'; - $_REQUEST['type'] = 'theme-install'; - - // Set up the screen - if (!function_exists('get_current_screen')) { - error_log('WPA Superstar: Loading admin screen functions'); - require_once ABSPATH . 'wp-admin/includes/screen.php'; - } - - if (!function_exists('set_current_screen')) { - error_log('WPA Superstar: Loading admin functions'); - require_once ABSPATH . 'wp-admin/includes/admin.php'; - } - - set_current_screen('theme-install'); - error_log('WPA Superstar: Fetching theme data for kadence'); // Get theme data with minimal fields @@ -338,24 +300,24 @@ function wpa_superstar_ajax_get_theme() {
description); ?>
+ +description); ?>