From 3d7965ceffcbc48ae1e6d64ae037c4e57256b66f Mon Sep 17 00:00:00 2001 From: Josh Cunningham Date: Tue, 4 Jan 2022 09:11:06 -0800 Subject: [PATCH] fix: meta key is incorrect for non-default database table prefix [#9] --- src/wp-rest-api-auth0.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/wp-rest-api-auth0.php b/src/wp-rest-api-auth0.php index b035173..f44f65f 100644 --- a/src/wp-rest-api-auth0.php +++ b/src/wp-rest-api-auth0.php @@ -20,6 +20,7 @@ * @return int|null */ function determine_current_user( $user ) { + global $wpdb; // Only checked, not saved or output anywhere. // phpcs:ignore WordPress.Security.ValidatedSanitizedInput @@ -69,7 +70,7 @@ function determine_current_user( $user ) { $wp_user = current( get_users( array( - 'meta_key' => 'wp_auth0_id', + 'meta_key' => $wpdb->prefix . 'auth0_id', 'meta_value' => $decoded_token['sub'], ) )