Hardcoding category protection


#1

Was previously using Memberful, but looking at moving over to Patreon. However, I had hardcoded the protection of three categories on Wordpress for three different membership tiers. Now I’m wanting to do that with Patreon pledges. My hardcoding for Memberful in my single.php file was:

<?php if ( has_category( array('plus', 'elite', 'gold')) && ! is_subscribed_to_memberful_plan ( array('15656-ennui-plus', '19593-ennui-plus-gold', '27417-ennui-plus-elite' ) ) ) { ?>

<?php the_post_thumbnail(); ?>




You can watch this content if you’re an Ennui Plus member, or a member on the Ennui Plus Gold or Ennui Plus Elite levels. Become a member now to get early access, exclusive content and more!

Is there a way to do this with Patreon?


#2

When you use the Patreon Plugin, you get the option to lock posts according to Tiers

Ennui Plus Tier - 10$ or whatever amount
Ennui Plus Gold Tier - 20$ or whatever amount
Ennui Plus Elite Tier - 30$ or whatever amount

Basically, you can lock your posts according to Tiers, so only people who pledge that amount will be able to see that post.


#3

Yes that can be done with that level of code modification, rather easily:

Patreon_Wordpress::getUserPatronage();

…will give you the pledge level of the current logged in patron. You can use this to custom-check for anything:

if(Patreon_Wordpress::getUserPatronage()>5) {

}

… for example, will allow you to check if a patron has higher than $5. You can use it anywhere.


#4

What would I be putting in my functions.php to create the function first, though?

I roughly know what to put in my single.php by adapting my Memberful one I made and the code you gave me.


#5

Not in single.php, but in category related templates. A quick google search can show you how to access these templates. Then you can wrap the listing loop in if’s.