# Show columns based on the Users Role

> Please note that this is now available as a plugin for easier installation. While you can use this document as a reference, the recommended method to add…

Source: https://tadabase.com/docs/snippets/show-columns-based-on-the-users-role  
Status: Not yet re-checked. Moved from our previous help site and not yet re-checked against the current product. Last edited Sep 20, 2024.

> **Warning:** Please note that this is now available as a plugin for easier installation. While you can use this document as a reference, the recommended method to add this functionality is through the plugin installation wizard. Learn more about plugins [here](https://tadabase.com/docs).

![Screenshot for “Show columns based on the Users Role”](https://tadabase-docs-assets.s3.amazonaws.com/uploads/images/gallery/2022-08/scaled-1680-/2022-08-26_14-28-25.png)

This is a way to customize a table with different views based on the logged-in user's role. Follow the steps below for this great customization.

> **Warning:** Please note that this solution simply hides the value from the page so it can still be accessed if a user has some HTML knowledge. If the column must be secured from view for a certain role, we recommend creating separate secure pages per role to ensure that your data remains appropriately secure.

**Step 1**

**Make sure you attach a specified role to each user.**

![Screenshot for “Show columns based on the Users Role”](https://tadabase-docs-assets.s3.amazonaws.com/uploads/images/gallery/2022-08/scaled-1680-/2022-08-26_14-44-02.png)

**Step 2**

**Add a CSS class for each assigned role, followed by the hide. Here I have management hide, packaging hide, shipping hide, and retail hide.**

[Video](https://www.screencast.com/users/stellrechtmegan/folders/Snagit/media/799333da-1ec5-4afd-8247-179dd796eb3b/embed)

**Step 3**

**Hover over the info icon on your page's data table to get the component ID.**

![Screenshot for “Show columns based on the Users Role”](https://tadabase-docs-assets.s3.amazonaws.com/uploads/images/gallery/2022-08/scaled-1680-/2022-08-26_14-54-05.png)

**Step 4**

**Add the following code to the JavaScript tab of your page.**

```
TB.render('component_ID', function(data) {
    if ('{loggedInUser.Role}' === 'Management') {
        $('.management').removeClass('hide');
    } else if ('{loggedInUser.Role}' === 'Packaging') {
        $('.packaging').removeClass('hide');
    } else if ('{loggedInUser.Role}' === 'Shipping') {
        $('.shipping').removeClass('hide');
    } else if ('{loggedInUser.Role}' === 'Retail') {
        $('.retail').removeClass('hide');
    }
});
```

![Screenshot for “Show columns based on the Users Role”](https://tadabase-docs-assets.s3.amazonaws.com/uploads/images/gallery/2022-08/scaled-1680-/2022-08-26_14-56-55.png)

> **Note:** Remember to change the component ID as well as the roles.

**Original Community Post:**

[https://community.tadabase.io/t/show-columns-based-on-the-users-role/1978](https://community.tadabase.io/t/show-columns-based-on-the-users-role/1978)
