data->user_pass, get_current_user_id()); } public function resetSettings() { $postData = wp_unslash($_POST ?? []); if (!current_user_can(self::PERMISSION) || !wp_verify_nonce($postData['ag_reset_settings'] ?? '', 'ag_reset_settings')) { wp_die('Disallowed action'); } if (!$this->auth($postData['pwd'])) { $this->redirect($postData['_wp_http_referer'], 0, 'tools'); } foreach (Immutable::AGE_GATE_OPTIONS as $option) { delete_option($option); } delete_option('age_gate_version'); Activate::activate(); $this->redirect($postData['_wp_http_referer'], 1, 'tools'); } public function resetPosts() { $postData = wp_unslash($_POST ?? []); if (!current_user_can(self::PERMISSION) || !wp_verify_nonce($postData['ag_reset_post'] ?? '', 'ag_reset_post')) { wp_die('Disallowed action'); } if (!$this->auth($postData['pwd'])) { $this->redirect($postData['_wp_http_referer'], 0, 'tools'); } global $wpdb; $wpdb->query("DELETE FROM {$wpdb->postmeta} WHERE meta_key LIKE '_age_gate-%'"); // phpcs:ignore WordPress.DB.DirectDatabaseQuery $wpdb->query("DELETE FROM {$wpdb->termmeta} WHERE meta_key LIKE '_age_gate-%'"); // phpcs:ignore WordPress.DB.DirectDatabaseQuery $wpdb->query("DELETE FROM {$wpdb->usermeta} WHERE meta_key LIKE '_age_gate-%'"); // phpcs:ignore WordPress.DB.DirectDatabaseQuery $this->redirect($postData['_wp_http_referer'], 1, 'tools'); } }