Hello. I started a project with Patreon for WordPress in April 2021. I have a site running PMPro and want to switch subscribers to Patreon. I put that project on hold to build a custom WordPress theme for the site.
Now I’m revisiting switching to Patreon. Where is all the documentation? Is it in Dropbox Paper?
I need to write some conditional statements checking if user is a valid patron, if they have an existing patron account, if their account is expired, that type of thing. How do I do that?
Thanks @jennbriden , I’ve built a custom WordPress theme. It currently uses PMPro for membership, and have several instances where I check if the user if logged in with a current membership and conditionaly display content. I want to do similar with Patreon.
@codebard I only have one patron level so will this suffice?
if( class_exists('Patreon_Wordpress') && Patreon_Wordpress::isPatron() ) {
// output for logged-in Patron
} else {
// output for all other users
}
or is it better to use
if( class_exists('Patreon_Wordpress') && Patreon_Wordpress:: getUserPatronage() ) {
// output for logged-in Patron
} else {
// output for all other users
}
is there a condition that checks that a user was formerly a patron? or one for users that have a Patreon account but not a patron of my specific account?
If you are using Patron Plugin Pro, everything is much easier: Every function in Patron Pro also functions as a hook and a filter. You can filter any parameter that goes into a function before the function runs. You can filter any output from any function. You can also run actions right before a function runs and right after a function completes, using the function’s own parameters. Ie, its like the WP hooks system, except every function has filters and hooks.
If you browse the plugin.php included in the plugin, you can see every single function that you can hook into.
Checking for user patronage amount is better and future proof. Just compare it to your current tier $ level, and do whatever you need to do based on the comparison. This way, in case you add more tiers, the comparison logic will still work.