Paywall and page level access restriction
You can paywall certain pages or restrict some pages for the Admin using a simple Yes/No field. No plugins or third-party software is needed.
You need a Yes/No field in the database which will store the user role value. It can also be a text field if you have multiple tiers like an Admin role, free member, lifetime member etc. To keep things simple, I’ve chosen a Yes/No field.
I’ve created field called Paying member and I want to restrict certain pages to only the users who are a member. In short, I need a paywall.
Go to the workflow section and click on ‘Add an event’. Under the ‘General’ section, choose ‘On page load’.
We’ll add a new action in this workflow which will redirect the user away to the Index page if the Paying member field is No.
On the other hand, if the Paying member is Yes, the user will stay on the same page.
The setup is not restricted to a Yes/No field, it’s entirely up to you to. You can use a number field, date field, text field or anything else.
There will be a small 1 sec delay before the user is navigated. This is the time Bubble takes to run the workflow. And it’s dependent on the user’s internet speed also.
If you have sensitive content on a page, you can either setup conditions on the elements to be visible only when the current user’s role is correct, or you can create a generic blank loading page. Before going to the restricted page, you can navigate the user to a blank loading and create the above workflows on that page. This way, the user will only see a blank page while Bubble decides which page the user should be redirected to.
If you need some help with your Bubble app, send me an email at email@example.com or follow me on Twitter
Become a Bubble power user. Get Bubble tips straight into your inbox