From d40d79c7bf5511158aa306154d38df861612879f Mon Sep 17 00:00:00 2001 From: Norcross Date: Mon, 1 Dec 2025 12:51:17 -0500 Subject: [PATCH 1/7] adding initial uninstall file Signed-off-by: Norcross --- uninstall.php | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 uninstall.php diff --git a/uninstall.php b/uninstall.php new file mode 100644 index 00000000..245c3b00 --- /dev/null +++ b/uninstall.php @@ -0,0 +1,11 @@ + Date: Mon, 1 Dec 2025 13:00:38 -0500 Subject: [PATCH 2/7] adding known standard and site options Signed-off-by: Norcross --- uninstall.php | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/uninstall.php b/uninstall.php index 245c3b00..f4dad5ce 100644 --- a/uninstall.php +++ b/uninstall.php @@ -9,3 +9,9 @@ if ( ! defined( 'WP_UNINSTALL_PLUGIN' ) ) { die; } + +// Delete our single keys. +delete_option( 'fair_indexnow_key' ); + +// Our multisite level options. +delete_site_option( 'fair_avatar_source' ); From bf8c6c3e6ac467b7f8a4026764e6456b6e843c07 Mon Sep 17 00:00:00 2001 From: Norcross Date: Mon, 1 Dec 2025 13:39:33 -0500 Subject: [PATCH 3/7] replacing string with namespaced constant Signed-off-by: Norcross --- uninstall.php | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/uninstall.php b/uninstall.php index f4dad5ce..37525fa1 100644 --- a/uninstall.php +++ b/uninstall.php @@ -10,8 +10,15 @@ die; } +// Include the avatar namespace so we can use the constant. +require_once __DIR__ . '/inc/avatars/namespace.php'; + // Delete our single keys. delete_option( 'fair_indexnow_key' ); // Our multisite level options. -delete_site_option( 'fair_avatar_source' ); +delete_site_option( \FAIR\Avatars\AVATAR_SRC_SETTING_KEY ); + +// Any transients we may have. +delete_site_transient( 'update_plugins' ); +delete_site_transient( 'update_themes' ); From 8e2ae512a1c701cde8b54b4c007f54986cc2623b Mon Sep 17 00:00:00 2001 From: Norcross Date: Mon, 1 Dec 2025 16:38:23 -0500 Subject: [PATCH 4/7] deleting FAIR user meta Signed-off-by: Norcross --- uninstall.php | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/uninstall.php b/uninstall.php index 37525fa1..fffa4fcb 100644 --- a/uninstall.php +++ b/uninstall.php @@ -13,12 +13,24 @@ // Include the avatar namespace so we can use the constant. require_once __DIR__ . '/inc/avatars/namespace.php'; -// Delete our single keys. +// Delete any single or multisite keys. delete_option( 'fair_indexnow_key' ); - -// Our multisite level options. delete_site_option( \FAIR\Avatars\AVATAR_SRC_SETTING_KEY ); -// Any transients we may have. +// Delete any transients we may have. delete_site_transient( 'update_plugins' ); delete_site_transient( 'update_themes' ); + +global $wpdb; + +// Prepare our delete query. +$query_args = $wpdb->prepare(" + DELETE FROM $wpdb->usermeta + WHERE meta_key IN ( + '%s', + '%s' + ) +", esc_attr( 'fair_avatar_site_id' ), esc_attr( 'fair_avatar_id' ) ); + +// And actually run it. +$wpdb->query( $query_args ); From 3e10ed8ebc69b8023d44ae64c64e51b69baa970d Mon Sep 17 00:00:00 2001 From: Norcross Date: Thu, 4 Dec 2025 10:52:48 -0500 Subject: [PATCH 5/7] updates for PHPCS linting Signed-off-by: Norcross --- uninstall.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/uninstall.php b/uninstall.php index fffa4fcb..c6cf4dea 100644 --- a/uninstall.php +++ b/uninstall.php @@ -27,10 +27,11 @@ $query_args = $wpdb->prepare(" DELETE FROM $wpdb->usermeta WHERE meta_key IN ( - '%s', - '%s' + %s, + %s ) ", esc_attr( 'fair_avatar_site_id' ), esc_attr( 'fair_avatar_id' ) ); // And actually run it. +// phpcs:ignore WordPress.DB.PreparedSQL.NotPrepared -- we did use the prepare function above $wpdb->query( $query_args ); From e07f44b7d0ae687df8c894b1de058b1e09ffd5d7 Mon Sep 17 00:00:00 2001 From: Norcross Date: Thu, 4 Dec 2025 11:20:33 -0500 Subject: [PATCH 6/7] comment update for the wordsmith Colin Signed-off-by: Norcross --- uninstall.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/uninstall.php b/uninstall.php index c6cf4dea..f04bcba2 100644 --- a/uninstall.php +++ b/uninstall.php @@ -17,7 +17,7 @@ delete_option( 'fair_indexnow_key' ); delete_site_option( \FAIR\Avatars\AVATAR_SRC_SETTING_KEY ); -// Delete any transients we may have. +// Delete any transients we may have created or modified. delete_site_transient( 'update_plugins' ); delete_site_transient( 'update_themes' ); From ee52e329c659e546abd1b30effd037ddf9ad5b0a Mon Sep 17 00:00:00 2001 From: Norcross Date: Thu, 4 Dec 2025 12:02:37 -0500 Subject: [PATCH 7/7] remove unneeded esc_attr Signed-off-by: Norcross --- uninstall.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/uninstall.php b/uninstall.php index f04bcba2..06098cfb 100644 --- a/uninstall.php +++ b/uninstall.php @@ -30,7 +30,7 @@ %s, %s ) -", esc_attr( 'fair_avatar_site_id' ), esc_attr( 'fair_avatar_id' ) ); +", 'fair_avatar_site_id', 'fair_avatar_id' ); // And actually run it. // phpcs:ignore WordPress.DB.PreparedSQL.NotPrepared -- we did use the prepare function above