Apologies in advance if this topic is redundant.
I’m trying to find a method to create gated content on a page.
My workflow is simple: as a registered user you buy a Stripe subscription and then you are redirected to the premium content.
How can I display this content only for paid subscribers and hide from the rest of users?
There are a few ways to do it. One of them is to attach plans to “User”. In your DB you insert a field “Plan” (e.g. Free, Advanced, Premium) inside the table “User”.
When user buy the plan make a change to User on this field e.g. “Plan = Advanced”. And insert conditionals to the contents you want to show. E.g. certain element will be visible if Current User’s Plan is Advanced.
Generally, you can use this approach Advice on Password protected page access
For your case, add a field (yes/no or subscription type) in the relevant datatype. When the user subscribes, change the field from default to paid and navigate the user. On the premium page, hide the main group if the current user sub is not paid and make visible some sort of popup to displaying something like. this page is for premium users.
Thanks a lot @ezduriez & @Nobi ! I will try these as well.
So far I hide the premium section of the page with: only when ‘Current User’s Stripe subscription’s Subscription_id is empty’ and it’s working.
Is this a safe approach or do I need to write extra privacy rules?
It depends on your business. When a user has a Subscription and this Subscription wasn’t paid in the renewal and you delete the user Subscription to empty it will work. Otherwise won’t.
You can also create a field to User like “subscription active: yes/no”.
This topic was automatically closed after 70 days. New replies are no longer allowed.