Preventing multiple accounts linked to same Patreon account

Hi,

I recently came across several users with multiple accounts linked to the same Patreon account. So far I’ve replicated it by following these steps:

  1. Create Wordpress account A using Patreon account Z
  2. Create Wordpress account B using register form
  3. Link the account to Patreon account Z

With this I would have two accounts A and B linked to Patreon account Z.

I guess something like this could get the job done, but can’t figure out where to modify the code:

// Check if there is an account already linked to this Patreon account
$user = get_users(array( 
	'meta_key' => 'patreon_user_id', 
	'meta_value' => $patreon_user_id, 
	'number' => 1
));

if ( $user != false ) {
	// A user with the Patreon id linked already exists
	wp_redirect( wp_login_url() . '?patreon_message=patreon_account_already_in_use', '301' );
	exit;
}

Should it be on the updateExistingUser function?

Thank you for the help :smiley:

Should multiple users being linked to the same Patreon account be a problem?

If a user is allowed to have multiple accounts at your site, they could link those accounts to the user’s Patreon since all accounts at your site belong to that user.

But if a user is not allowed multiple accounts, this sounds like something that would need to be handled at your site by preventing multiple registrations based on any criteria you see fit.

Mmm… shouldn’t it be a 1:1 relation where you probe that the linked account is owned by the same person as the Patreon account? 1:N would allow people to “distribute” accounts with the Patreon benefits, right?

Not necessarily. People can have more than one account on a platform. Or, they could have more than one identity in one single account. How you approach this totally depends on the setup of your site, your campaign and your rewards.

1:N would allow people to “distribute” accounts with the Patreon benefits, right?

It shouldnt. Only the latest active connection (patronage) would be taken into account currently.