Give users a custom role based on pledge amount

I would like to give Patreon Users a custom role based on pledge amount.

From what i understand neither the free or premium version of the WordPress plugin have this functionality. I would like to however know if there is some way to fire a function when a user logs into my website via patreon that can:

  1. Get some metadata on the user
  2. Somehow check the pledge amount or range?
  3. Assign a custom user role to to the user.

Am I correct in saying that not even the premium version of the plugin does this out of the box?

Your help would be much appreciated.

Thanks,

Patron Pro does not assign a specific user role, but you can assign VIP status or custom $ level status to users.

What you speak of can be done by user role plugins from WP repo. You would need to find one that checks user metas and then assign a role to user based on a value.

Thanks for your reply, what exactly would i be looking for in the User Metas? I can’t see anything there that specifically points the pledge amount.

Is there an object returned by patreon that I can access in order to check the current pledge amount?

patreon_user_id meta field will give you the Patreon account id of a user. If it does not exist, then the user is not recorded as a Patreon user in local WP installation. (ie, never logged in via Patreon or linked the account).

Awesome I will give that a go.

I’m getting some weird behaviour now where I have created a test patreon account with a different email from my WP admin account though logging in with patreon returns me to my site logged in as Admin. My avatar has been updated to the Patreon avatart too. Have you seen this issue before? I’ve cleared cookies and used incognito though somehow my Admin account has been linked to the test Patreon account. Very frustrating.

Yes your admin account may have been linked to your Patreon account in such a case.

Ok so I have created another test account with a different email address and I have been able to login to the site with Patreon user however the username created is somthing like “Patreon_123455669” and I’m unable to return any WP User Meta on this user.

Are all Patreon users given a generic username like this? Why can’t i retrieve the user meta on this user?

I’m using the premium plugin.

the username is generated properly in that example - the later part is Patreon user id.

The account should have a meta attached to it as i mentioned. If you cant get metas for that user, this may be something related to a plugin at your site or some site setup situation.