Left Admin Menu

works with admin groups - Left Admin Menu

works with admin groups

by ce7 » Tue May 31, 2022 3:04 am

@zipurman
Hi,
thank you for the addon.

I also installed admin groups, is it possible the left admin menu only available when the access has no limitation, in other words I mean when has file limitation to admin groups, then only top dropdown menu showup. If it is possible, how can I modify the hMenu.php in order to do so? Thank you!

admin group code modified in hMenu.php

Code: Select all

                    foreach ( $cl_box_groups as $groups ) {
  //BOF  admin group
                      if(display_block_to_admin_group($groups['heading'])) {
  //EOF  admin group
                        $mr .= '<li class="nav-item dropdown">';
                        $mr .= '<a class="nav-link dropdown-toggle" href="#" id="navbar_' . $n . '" role="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">' . $groups['heading'] . '</a>';
                        $al = ( $n > 6 ) ? ' dropdown-menu-right' : '';
                        $mr .= '<div class="dropdown-menu' . $al . '" aria-labelledby="navbar_' . $n . '">';
                        foreach ( $groups['apps'] as $app ) {
  //BOF admin group
                          if(check_admin_group($app['code'])) 
  //EOF  admin group
                            $mr .= '<a class="dropdown-item" href="' . $app['link'] . '">' . $app['title'] . '</a>';
                        }
                        $mr .= '</div>';
                        $mr .= '</li>' . PHP_EOL;

                        $n ++;
                    }
  //BOF  admin group
                    } 
  //EOF  admin group

is it something like this?

Code: Select all

if(!display_block_to_admin_group($groups['heading'])) {
                //LEFT MENU BELOW ---------------------------------------------------------------------
...
                        $n ++;
                    }
}
ce7
Member
Posts: 26
Joined: Tue Apr 06, 2021 12:26 am
Phoenix Version:
Contact:

Re: works with admin groups

by zipurman » Tue May 31, 2022 4:04 am

The problem is that hMenu is not aware of any of the work done inside of the Admin Levels areas. You could hack hMenu.php and add the following:

Added to: hMenu.php around line 61 ... just before the "return <<<style" line

Code: Select all

 $query          = tep_db_query( "SELECT COALESCE(COUNT(asec.administrators_id)) AS x FROM admin_security asec, administrators a WHERE a.id=asec.administrators_id AND a.user_name = '" . $_SESSION['admin']['username'] . "'" );
            $this->security = [];
            $result = tep_db_fetch_array( $query );
            if (!empty($result['x'])){
                $_SESSION['admin_menu_type']  = 1;
            }
zipurman
-----------
User avatar
zipurman
Builder
Posts: 540
Joined: Tue Oct 13, 2020 5:20 pm
Phoenix Version: v
Contact: