Admin Profiles in zencart v1.3.9

0

Set permision to users in zencart

Do you want to set permission to your users in zencart admin/super admin download the module from zencart and follow my steps
http://www.zen-cart.com/index.php?main_page=product_contrib_info&cPath=40_41&products_id=86

Installing Admin Profiles v1.1.1

These notes can look daunting, but follow them step by step and they’re really not too bad 
Free support for Admin Profiles is available on the Admin Profiles Support thread at the Zen Cart forum from other users and from us as and when our workload allows it. If you get really stuck then commercial assistance at our normal consultancy rates is sometimes available (ap@kuroi.co.uk).

Step 1

Run the install_admin_profiles.sql file using Zen Cart’s Admin > Tools > Install SQL Patch facility
** It is very important that this step is done first **

Step 2

Copy the files in the install/admin to the equivalent places in your admin folder. They already have the correct folder structure so a single drag and drag and drop of the “Admin” folder into the root directory for your store will put the files in the correct locations if you are using a reliable FTP program such as FileZilla. (Hint: if you’ve renamed your admin – and you should have done – rename the folder in this mod before you drag it to your FTP program.)


  • admin/admin_control.php
  • admin/alt_nav.php *
  • admin/denied.php
  • admin/images/icon_permissions.gif
  • admin/includes/admin_profiles.css
  • admin/includes/header_navigation.php *
  • admin/includes/auto_loaders/config.admin_profiles.php
  • admin/includes/boxes/configuration_dhtml.php
  • admin/includes/extra_datafiles/admin_profiles_data.php
  • admin/includes/functions/admin_profiles.php
  • admin/includes/init_includes/overrides/init_admin_auth.php
  • admin/includes/languages/english/admin_control.php
  • admin/includes/languages/english/denied.php
  • admin/includes/languages/english/images/buttons/button_edit_permissions.gif

* Please note that we are over-writing the alt_nav and header_navigation files. This is because these files have a lot of changes. If you have made changes for them for other add-on modules, you will need to reapply those changes after installing Admin Profiles.

Step 3 (To allow you to assign permissions to admin users)

Patch One
In admin/admin.php find the line containing the constant ICON_RESET (line 194 in Zen Cart 1.3.9h). Insert a new line immediately afterwards containing the following …

<?php echo '<a href="' . zen_href_link(FILENAME_ADMIN_CONTROL, 'adminID=' . $admins->fields['admin_id']) . '">' . zen_image(DIR_WS_IMAGES . 'icon_permissions.gif', ICON_PERMISSIONS) . '</a>'; ?>

Patch Two
Also in admin/admin.php, replace the line that begins 'text' => '<a href="' . zen_href_link(FILENAME_ADMIN with ... (line 316 in Zen Cart 1.3.9h)

  'text' => '<a href="' . zen_href_link(FILENAME_ADMIN, 'page=' . $_GET['page'] . '&adminID=' . $adminInfo->admin_id . '&action=edit') . '">' . zen_image_button('button_edit.gif', IMAGE_EDIT) . '</a><a href="' . zen_href_link(FILENAME_ADMIN, 'page=' . $_GET['page'] . '&adminID=' . $adminInfo->admin_id . '&action=resetpassword') . '">' . zen_image_button('button_reset_pwd.gif', IMAGE_RESET) . '</a><a href="' . zen_href_link(FILENAME_ADMIN, 'page=' . $_GET['page'] . '&adminID=' . $adminInfo->admin_id . '&action=delete') . '">' . zen_image_button('button_delete.gif', IMAGE_DELETE) . '</a><br /><a href="' . zen_href_link(FILENAME_ADMIN_CONTROL, 'adminID=' . $adminInfo->admin_id) . '">' . zen_image_button('button_edit_permissions.gif', IMAGE_PERMISSIONS) . '</a>');

Patch Three
In admin/includes/languages/english.php insert the two lines below. They can go virtually anywhere, but for maintainability I recommend that you preserve the documents categorization and alphabetical order (i.e. pop them in after lines 320 and 348 respectively).

  define('IMAGE_PERMISSIONS', 'Edit Permissions');
  define('ICON_PERMISSIONS', 'Permissions');

Patch Four
In admin/includes/functions/general.php comment out the zen_draw_admin_box function (line 2954 in Zen Cart 1.3.9h). To do this add a “/*” before the function and a “*/” afterwards so that it looks like this …

/*
  function zen_draw_admin_box($zf_header, $zf_content) {
    $zp_boxes = '<li class="submenu"><a target="_top" href="' . $zf_header['link'] . '">' . $zf_header['text'] . '</a>';
    $zp_boxes .= '<UL>' . "\n";
    for ($i=0; $i<sizeof($zf_content); $i++) {
      $zp_boxes .= '<li>';
      $zp_boxes .= '<a href="' . $zf_content[$i]['link'] . '">' . $zf_content[$i]['text'] . '</a>';
      $zp_boxes .= '</li>' . "\n";
    }
    $zp_boxes .= '</UL>' . "\n";
    $zp_boxes .= '</li>' . "\n";
    return $zp_boxes;
  }
*/

Step 4 (To make chosen pages available to all users)

** This step is very rarely needed or appropriate **
Pages that everyone should be able to view i.e those of the same level of criticality as index, login, logoff, etc, should be added to the array in line 23 of admin/includes/init_includes/overrides/init_admin_auth.php

Step 5 (To manage user permissions)

  1. Log in to admin (if it is your first time in, you will need to be the user with admin_id = 1).
  2. Go to Admin > Tools > Admin Settings
  3. Click on Permissions icon (white p in an orange circle) for the user whose permissions you want to edit. There are two levels of control, menu headers (e.g. configuration, catalog, modules, and individual pages).
  4. You can make menu headers visible or invisible by clicking on the check box next to their name and saving the change. Do this on your own account and you will immediately see the result. However, this does not control whether the underlying pages are accessible or not, just whether the user can see them. They could still be accessed by a knowledgeable user entering a URL directly, or by any custom admin page that you choose to build for them.
  5. Pages can be turned on or off by checking or unchecking the check box next to each page description and saving the change(s). This controls absolutely whether or not the user can access them. Again, do this on your own account and you will immediately see results.
  6. As an aside, turning off the tools menu on your own account, or the admin function it, are both strongly discouraged unless you know what you are doing, as the next time you log on you will find that you can no longer maintain your or anybody else’s profile!