code help to block members who aren't a part of a pricing plan

Hi,

I was given the below advice however I am still struggling in creating the code, can anyone help me?

To prevent members from interacting in a website/app is blocking a member. You can do that today using Wix Velo: https://www.wix.com/velo/reference/wix-members-backend/authentication/blockbyemail

In your case you may want to block members who aren’t a part of a pricing plan (i.e. they don’t have it because they haven’t paid or similar). That, again, can be checked using Wix Velo https://www.wix.com/velo/reference/wix-pricing-plans-backend/orders/listorders

So all you need to do is create a recurring job ( https://support.wix.com/en/article/velo-scheduling-recurring-jobs ) which iterates through each member and blocks it (member won’t be able to log-in) if they aren’t under a pricing plan. And also, it may unblock a member once they pay for a pricing plan.

Thanks,
Kelly

I thought of another direction.
Create a member role “Subscriber”.
Restrict the relevant pages to members with this role (via the Page Settings).
Once a member purchased a plan, assign the role,
Once the plan got cancelled or expired - remove the role.

https://www.wix.com/velo/reference/wix-pricing-plans-backend/events/onordercreated

https://www.wix.com/velo/reference/wix-pricing-plans-backend/events/onordercanceled

https://www.wix.com/velo/reference/wix-pricing-plans-backend/events/onorderended

https://www.wix.com/velo/reference/wix-members-backend/authorization

Sorry, you don’t need this solution, you can restrict the page to Pricing Plan only, just through the page settings.