Patron subscription status sync

Hi, while going through the plugin’s code, I noticed the Patreon user details are only updated while the user is browsing the website (the updatePatreonUser call at the wp_head action). This is ideal for post reading but if I want to give a perk to a user (even if not connected for a while), the latest status might be wrong (in case the subscription was cancelled) and will assign perks to unsubscribed users with outdated information.

Example scenario:

  • November: the user links the Wordpress and Patreon (with an active subscription) accounts. The status is active_patron.
  • December: the status remains the same as November.
  • January: the user logs in the status is updated but stays as active_patron.
  • February: the user cancels the subscription but doesn’t log in. The status remains as active_patron.
  • March: even if the user cancelled the subscription the status remains as active_patron since the details were not updated.
  • April: the user logs in and the status is updated to former_patron.

I’m looking to be able to assign the perks corresponding to December, January and February but don’t want to the user to keep receiving the perks for March (in April the status would be updated and would not receive anything).

Is there any option to sync the user statuses without having to iterate through all the users and calling a modified updatePatreonUser function? In case that’s the only option, what should be the right amount of API calls to avoid spamming?

Please feel free to correct me if I’m wrong.

Thank you!
deantonious

At the moment there isn’t a method to regularly sync users in the way you want. However there is a potential syncer addon that will likely be published as a premium plugin in a few months. If you would like to do it yourself (in case you are competent with WP and PHP), then I can give you some code so that you can implement it on your site.

Sure! Let me dm you :smiley:

I would also like this code please :slight_smile: