Restrict category access to certain roles

3.45K viewsGeneral
0

Hi,

I currently have 2 membership levels – subscriber & premium – I want to restrict certain categories to only the ‘premium’ members.

I know this is something you do with the ‘AnsPress Paid Memberships’ extension, I’ve purchased this and realised it’s not right for me as it’s dependent on the ‘Paid Memberships Pro’ plugin.

This doesn’t work for me as I already have my own membership payment functionality so installing ‘Paid Memberships Pro’ isn’t an option for me.

Ideally I’d like to strip out the code from that plugin which handles this bit: https://anspress.io/wp-content/uploads/2016/03/anspress-pm-level-option.png?a9379d

Setting certain categories to user roles

Any suggestions or ideas on how to go about this?

Lex

commented

Hello Lex,
Please tell us which paid membership plugin you are using so that we can make our extension compatible with it.

It’s custom made, uses a gravity form with PayPal. Then when I get the IPN notification from PayPal I use the gravity forms hooks to upgrade a user.

I’m not looking for 3rd party plugin integration. I just want to limit certain categories to user roles

Oh okay. All AnsPress roles and permission can be overridden easily. Have a look at class-anspress-hooks.php in AnsPress Paid Membership plugin.