Fix OAuth session collision overwriting admin identity#213
Draft
tyoung-patreon wants to merge 4 commits intomasterfrom
Draft
Fix OAuth session collision overwriting admin identity#213tyoung-patreon wants to merge 4 commits intomasterfrom
tyoung-patreon wants to merge 4 commits intomasterfrom
Conversation
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
…n points Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
…ed-in user Prevents same-browser session collision where an OAuth callback overwrites the logged-in admin's Patreon identity with a different patron's data. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Rename user_firstname/user_lastname to patreon_user_firstname/patreon_user_lastname so that syncing Patreon profile data does not silently overwrite the WordPress user's display name and profile fields. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
https://www.patreondevelopers.com/t/admin-display-name-nickname-changing-when-patreon-members-join/11295
The OAuth callback in
createOrLogInUserFromPatreon()links the incoming Patreon identity to whoever is currently logged into WordPress — not necessarily the user who started the flow. If an admin is logged in when a different Patreon account completes OAuth in the same browser, the admin's Patreon identity and display name get overwritten.Additionally,
updatePatreonUser()writes Patreon names into WordPress's built-inuser_firstname/user_lastnamemeta keys, silently replacing the user's WordPress profile name.Fix
stateparameter, verified on callback before linking to a logged-in user. Mismatches fall through to the standard lookup/create path.user_firstname/user_lastnametopatreon_user_firstname/patreon_user_lastnameso Patreon sync doesn't collide with WordPress profile fields.Test plan
patreon_user_idis NOT overwritten