Using “Current Page User” to Create an Admin Dashboard for your Bubble App
Knowing how to create accounts for other people and then being able to also manage those accounts can be a necessity for your app. Fortunately Bubble makes managing user accounts in your app real easy to do. In this video you’ll learn how to modify (or update) data fields in user accounts. This will allow you to create a “User Admin” dashboard in your app so you can manage your user accounts. There’s one little tip you really need to be aware of when you design your admin dashboard correctly. You need to know the difference between “Current User” and “Current Page User” (or Current Cell User for Repeating Groups).
When you log into your app, you are the “Current User”. To administer (or change) one of your user’s accounts, you can do so while you’re logged in your account. While you are still “Current User”, the other users are now “Current Page User”.
Let’s walk thru an example and say you want to update the status of a user from “Passive account” to “Active account”. In your Workflow, you would make a change to “Current Page User” (refer to image below). Note the editor will also give you a choice of “Current User” for the “Thing to Change” (in addition to “Current Page User”). If you choose “Current User”, you’ll be changing your account and not your users so make sure you choose “Current Page User”.
Making changes to users is straightforward – you just need to make sure your Workflows use “Current Page User”. For any text fields you also want to make sure you choose “Current Page User” or you’ll be showing the data for you (the “Current User”).
Now that you know the difference between “Current User” and “Current Page User”, you can go and create your own customized user Admin Dashboard with the ability to make updates to your users.
“Current Page User” is a powerful and useful capability not only for you but also for your users. For instance, if your app has different types of users, i.e a Manager and Employees, you can apply “Current Page User” so the Manager (the “Current User”) can make updates to their Employee’s profiles (“Current Page User”).
One final tip which I cover in the the video. You want to “protect” your Admin page to prevent unauthorized users from accessing your Admin Dashboard. This can be done by adding a “Go to page index” Workflow Step when Page is loaded. Then add an “Only when” conditional that says if it’s any user except you, execute the Workflow Step. This is a good habit for any page that you want to prevent unauthorized access.
You now have the ability to create and modify data fields for your users. This capability can really help enhance the power of your app and add convenience to both you and your users.