Skip to main content

Snippets Based on User Role - Advanced Component

In this video you will understand how you can create Snippets based on the logged in User Role. For eg., different sidebar or header on a page for different users on the basis of their roles.

This way you can avoid creating unnecessary pages when several different type of users want to access the same page but have different options in the sidebar or header menu.

1. Add a Snippet

To begin you would have to create a snippet to your project. To do this you can use the Advanced category choose the Snippets component.

In the form that appears choose the Settings icon and mention the snippet name from the dropdown.

Then use the Save icon to finish building your data table. When you Reload the page the snippet will appear there.

DrapCode Builder Collection Constructor

2. Create a Snippet

To create a snippet based on any specific user role choose the Settings icon of the Data Table and mention the snippet name from the dropdown. Then select the Handle via User Role option.

Then use the Save icon to finish. When you Reload the page the snippet will appear on it.

DrapCode Builder Collection Constructor

3. View the Snippet

Enter the login details and submit them. On doing so it will display the details of the user and the snippet created on the page.

You can open a new window and login the user and view the snippet in a new page too the same way.

DrapCode Builder Collection Constructor