# Give users a custom role based on pledge amount

**URL:** <https://www.patreondevelopers.com/t/give-users-a-custom-role-based-on-pledge-amount/3044>\
**Category:** Wordpress Plugin\
**Created:** [April 23, 2020, 11:25am UTC](https://www.patreondevelopers.com/t/give-users-a-custom-role-based-on-pledge-amount/3044 "2020-04-23T11:25:17Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![kasio99](https://avatars.discourse-cdn.com/v4/letter/k/8491ac/32.png) [@kasio99](https://www.patreondevelopers.com/u/kasio99)\
**Post date:** [April 23, 2020, 11:25am UTC](https://www.patreondevelopers.com/t/give-users-a-custom-role-based-on-pledge-amount/3044/1 "2020-04-23T11:25:17Z")

</div>

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,

---

<div class="post-metadata">

**Author:** ![codebard](https://yyz2.discourse-cdn.com/flex036/user_avatar/www.patreondevelopers.com/codebard/32/14_2.png) [@codebard](https://www.patreondevelopers.com/u/codebard)\
**Post date:** [April 24, 2020, 5:31am UTC](https://www.patreondevelopers.com/t/give-users-a-custom-role-based-on-pledge-amount/3044/2 "2020-04-24T05:31:23Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![kasio99](https://avatars.discourse-cdn.com/v4/letter/k/8491ac/32.png) [@kasio99](https://www.patreondevelopers.com/u/kasio99)\
**Post date:** [April 25, 2020, 10:05pm UTC](https://www.patreondevelopers.com/t/give-users-a-custom-role-based-on-pledge-amount/3044/3 "2020-04-25T22:05:57Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![codebard](https://yyz2.discourse-cdn.com/flex036/user_avatar/www.patreondevelopers.com/codebard/32/14_2.png) [@codebard](https://www.patreondevelopers.com/u/codebard)\
**Post date:** [April 27, 2020, 11:21am UTC](https://www.patreondevelopers.com/t/give-users-a-custom-role-based-on-pledge-amount/3044/4 "2020-04-27T11:21:00Z")

</div>

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).

---

<div class="post-metadata">

**Author:** ![kasio99](https://avatars.discourse-cdn.com/v4/letter/k/8491ac/32.png) [@kasio99](https://www.patreondevelopers.com/u/kasio99)\
**Post date:** [April 27, 2020, 12:20pm UTC](https://www.patreondevelopers.com/t/give-users-a-custom-role-based-on-pledge-amount/3044/5 "2020-04-27T12:20:36Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![codebard](https://yyz2.discourse-cdn.com/flex036/user_avatar/www.patreondevelopers.com/codebard/32/14_2.png) [@codebard](https://www.patreondevelopers.com/u/codebard)\
**Post date:** [April 27, 2020, 12:43pm UTC](https://www.patreondevelopers.com/t/give-users-a-custom-role-based-on-pledge-amount/3044/6 "2020-04-27T12:43:31Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![kasio99](https://avatars.discourse-cdn.com/v4/letter/k/8491ac/32.png) [@kasio99](https://www.patreondevelopers.com/u/kasio99)\
**Post date:** [April 28, 2020, 2:06am UTC](https://www.patreondevelopers.com/t/give-users-a-custom-role-based-on-pledge-amount/3044/7 "2020-04-28T02:06:10Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![codebard](https://yyz2.discourse-cdn.com/flex036/user_avatar/www.patreondevelopers.com/codebard/32/14_2.png) [@codebard](https://www.patreondevelopers.com/u/codebard)\
**Post date:** [April 28, 2020, 1:51pm UTC](https://www.patreondevelopers.com/t/give-users-a-custom-role-based-on-pledge-amount/3044/8 "2020-04-28T13:51:30Z")

</div>

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.
