Configuring Gambio2 admin menu

This article describes how to modify the administrator menu in Gambio2. The admin menu builds a 2-level hierarchy:

  1. The first level is called groups and each group has an icon.
  2. The second level is called menu items. Each item has a title that appears in the menu and an associated link.


The following files and directories are relevant for this tutorial:

  • system/conf/AdminMenu/
    Any XML file in this folder starting with menu_ is parsed by the shop in order to build the admin menu. This allows plugins to add menu items to existing menus. The templates are parsed with Smarty.
  • system/data/
    The class AdminPermSource checks whether a user is permitted access to a certain site. Whenever you add a link to the menu, you have to allow your admin user to see it.

The full “traceback” of the admin menu generation process looks like this:

  • admin/start.php
    This is the entry page of the administrator panel. The table cell columLeft2  contains the administrator menu. Its content is loaded by a script called colum_left.php.
  • admin/includes/column_left.php
    This script creates an instance of AdminMenuContentView that renders the administrator view.
  • system/views/AdminMenuContentView
    This class fetches the menu structure from AdminMenuControl and renders it.
  • system/controls/
    This class is responsible of composing the menu entries with respect to the current user. It queries the AdminPermSource for user permissions and AdminFavoritesSource for the current user’s favorites
  • system/data/
    This class does the permission management for the administrator views. It queries the database table admin_access.
  • system/data/
    This class parses the XML files in system/conf/AdminMenu and builds the menu structure regardless of user permissions.
  • system/data/
    This class reads favorite menus from the database table gm_admin_favorites.


In this section, I provide step-by-step instructions on how to add a menu item to the Layout/Design menu that simply show the output of phpinfo.

The dummy script

First, we create a tiny script called phpinfo.php in the admin folder of the shop and add the following content:


Adding a menu item

Afterwards, we create an XML file for our custom menu entry in conf/AdminMenu/menu_roland.xml:

<?xml version="1.0"?>
    <menugroup id="BOX_HEADING_GAMBIO">
        <menuitem sort="100" link="phpinfo.php" title="PHPinfo" />

This will add a new menu item to the Layout/Design menu. Other menus can be found in the file conf/AdminMenu/gambio_menu.xml. The sort attribute defines a relative ordering, the lower the number, the earlier the item appears within a group. The link target is appended to when the menu item is clicked and the title is the text that appears as menu item.

Permitting access

This part is a little ugly: We will hard-code the access permissions into the shop system.

The regular way of granting access to a new menu item is done in the database: The table admin_access contains one column for a user or group id and for any menu entry/view there exists a column which has a 1 in a user’s row if the user may see the column and 0 otherwise.

In our scenario we would need to add a column called phpinfo (without the .php extension).

Another option is to hardcode the permission check. For this, we open the file system/data/ and modify the method is_permitted as follows:

function is_permitted($p_customers_id, $p_admin_page) {
    if ($p_admin_page === "phpinfo.php") {
        return true;
    // Rest as before    

This hack only shows the way how you can circumvent the database-based access control –  the code may be refined, of course.

Cleaning the cache

Before seeing the results of your work, you have to visit and then clear the cache (both for generated pages and for module information).


When you now reload the admin panel and take a look at the Design/Layout menu, you should find a menu item called PHPinfo there.



1 comment

  1. you solved my life. this is what is search about four hours. important is to clear the cache, first the site cache and then the modules cache.

Leave a Reply