How To Create User Permissions View To Dynamic Sidebar Menu AdminLTE

Seegatesite.com – I’ll share how to create a user permissions view to dynamic sidebar menu on adminLTE using Mysql. Someone asks through this website, how do I create a user permission view for my application. Because if I explain through the comment form will be very long at all, so on this occasion I try to write tutorial my way to create user permissions view for dynamic sidebar menu adminLTE.

How To Create User Permissions View To Dynamic Sidebar Menu Adminlte

Before starting , you should read Creating dynamic sidebar menu with Mysql and AdminLTE Bootstrap Template

Create 3 pieces of tables t_user, t_menu, t_menu_sub to accommodate the data

t_user table

Create Table T User How To Create User Permission View To Dynamic Sidebar Menu Adminlte

Fill the following data

r_menu table

Create Table R Menu How To Create User Permission View To Dynamic Sidebar Menu Adminlte

Fill the following data

r_menu_sub table

Create Table R Menu Sub How To Create User Permission View To Dynamic Sidebar Menu Adminlte

Fill the following data

Here I will not explain in detail how to create the overall form on adminLTE but I will only discuss how to create a user permissions view on adminLTE dynamic sidebar menu , if you want the full code please download at the end of the article.

Script on the adminLTE sidebar menu

Explanation :

The main script to create dynamic menu with user permissions view is the following script

$_SESSION[‘h_menu’] store h_menu value (user permission access field) from t_user table

in my example t_user table has the following value

Create User Permission Access

$_SESSION[‘h_menu’] has the value “1,2,3,4,5,6,7,8,9” > id_menu_sub. In my example, r_sub_menu has 9 rows of data with id_menu_sub 1,2,3,4,5,6,7,8,9

When table r_menu_sub looping, it will check if id_menu_sub match with user permission access value in array, if same it will show menu

Try to change the h_menu value to “1,3,4,5,7”. What will happen ?

Hopefully this brief tutorial can help you to create a user permissions view on adminLTE sidebar.

To get the full source code please download the following link

Thus article about How To Create User Permissions View To Dynamic Sidebar Menu AdminLTE 🙂

The following two tabs change content below.
This site is a personal Blog of Sigit Prasetya Nugroho, a Desktop developer and freelance web developer working in PHP, MySQL, WordPress.

13 Comments

 Add your comment
  1. password user ADMIN apa pak?

  2. JIka hanya menu single di r_menu dan tidak ada di r_menu_sub, bagaimana caranya agar icon V tidak tampil. Sudah coba ubah tapi tetap tampil.

    • hapus script ini

      • Ini script dari sidebar.php

        • maaf salah kasih jawaban,

          Hapus yang ini

          • Ini icon V harus tampil karena ada di tabel r_menu dan r_menu_sub

            Dashboard – Dashboard 1
            – Dashboard 2
            Tabel – Tabel 1
            – Tabel 2

            Ini icon V tidak boleh tampil karena hanya ada r_menu

            User
            Logout

          • oooo… maksutnya kalo tidak ada sub menu maka icon v tidak ditampilkan gitu ? okay…ubah script seperti berikut

            Semoga membantu anda 🙂

          • Menu sidebar gak tampil, nanti sy coba lagi, thank’s ya

          • Sebenarnya intinya hanya pada kode berikut

            mengecek terlebih dahulu apakah r_menu memiliki sub_menu ? jika tidak maka icon v tidak ditampilkan

  3. Tanpa login index.php masih bisa kebuka ya

Leave a Comment

Your email address will not be published.

Time limit is exhausted. Please reload CAPTCHA.

This site uses Akismet to reduce spam. Learn how your comment data is processed.