diff --git a/assets/js/plugin-check-admin.js b/assets/js/plugin-check-admin.js index 962b0a359..9b971588e 100644 --- a/assets/js/plugin-check-admin.js +++ b/assets/js/plugin-check-admin.js @@ -35,11 +35,6 @@ canRunChecks(); pluginsList.addEventListener( 'change', canRunChecks ); - /** - * Saves the user settings. - * - * @since n.e.x.t - */ function saveUserSettings() { const selectedCategories = []; @@ -52,7 +47,7 @@ // Join the selected category slugs with '__' and save it as a user setting. const settingValue = selectedCategories.join( '__' ); - window.setUserSetting( 'category_preferences', settingValue ); + window.setUserSetting( 'plugin_check_category_preferences', settingValue ); } // Attach the saveUserSettings function when a category checkbox is clicked. diff --git a/includes/Admin/Admin_Page.php b/includes/Admin/Admin_Page.php index 40ef5765a..9b070c74a 100644 --- a/includes/Admin/Admin_Page.php +++ b/includes/Admin/Admin_Page.php @@ -165,7 +165,9 @@ public function render_page() { $categories = Check_Categories::get_categories(); - $user_settings = get_user_setting( 'category_preferences' ); + // Get user settings for category preferences and set a default value to check all categories by default. + $user_settings = get_user_setting( 'plugin_check_category_preferences', 'all_categories' ); + $user_settings = explode( '__', $user_settings ); require WP_PLUGIN_CHECK_PLUGIN_DIR_PATH . 'templates/admin-page.php'; } diff --git a/templates/admin-page.php b/templates/admin-page.php index a9dd14648..905a5b138 100644 --- a/templates/admin-page.php +++ b/templates/admin-page.php @@ -45,18 +45,7 @@