How to create your own custom User Groups in X-Cart
Creating custom user groups can be a pain in XCart, which is why I created this simple step by step guide so you can create your own custom user groups.
Just follow these steps and you should have everything all set and good to go.
1. We will first start off by creating 2 administration users. In this case I used "processor" and "manager"
2. Go into phpMyAdmin
3. Select xcart_memberships
4. Insert a new field and set the following parameters
membershipid: #
area: P
membership: put whatever name you want
orderby: 0
flag: insert whatever name or series of letters you want
save.
5. Go to xcart_customers
6. Select all and browse
7. Select the member you wish to edit
8. Go to membershipid and pending_membershipid and set those to the membershipid which you set in step 4.
9. Open 'include\security.php' and find the following lines of code
| if ($user_account["flag"] == "FS") { $_fulfillment_scripts = array( "stats_search.php", "search.php", "product_modify.php", "orders.php", "order.php", "generator.php", "statistics.php", "register.php", "help.php", "process_order.php", "popup_product.php", "anti_fraud.php", "import.php", "get_export.php" ); if (!preg_match("/(?:^|\/)([\w\d_]+\.php)\??(.*)/", $REQUEST_URI, $_fulfillment_match) || !in_array($_fulfillment_match[1], $_fulfillment_scripts)) if ($_fulfillment_match[1] == 'statistics.php' && $mode == 'logins') |
10. Yours will look different than mine because I have edited mine!
11. Now copy what you have from 'security.php' and paste it right below it. So it will look something like this
| if ($user_account["flag"] == "FS") { $_fulfillment_scripts = array( "stats_search.php", "search.php", "product_modify.php", "orders.php", "order.php", "generator.php", "statistics.php", "register.php", "help.php", "process_order.php", "popup_product.php", "anti_fraud.php", "import.php", "get_export.php" ); if (!preg_match("/(?:^|\/)([\w\d_]+\.php)\??(.*)/", $REQUEST_URI, $_fulfillment_match) || !in_array($_fulfillment_match[1], $_fulfillment_scripts)) if ($_fulfillment_match[1] == 'statistics.php' && $mode == 'logins') if ($user_account["flag"] == "FS") { if (!preg_match("/(?:^|\/)([\w\d_]+\.php)\??(.*)/", $REQUEST_URI, $_fulfillment_match) || !in_array($_fulfillment_match[1], $_fulfillment_scripts)) if ($_fulfillment_match[1] == 'statistics.php' && $mode == 'logins') |
12. In the new series of code that you just pasted your going to need to edit the bolded sections
13. It will look like this when your done
| if ($user_account["flag"] == "INSERT THE FLAG YOU SET IN STEP 4") { $_INSERT THE USER GROUPS NAME HERE_scripts = array( "stats_search.php", "search.php", "product_modify.php", "orders.php", "order.php", "generator.php", "statistics.php", "register.php", "help.php", "process_order.php", "popup_product.php", "anti_fraud.php", "import.php", "file_edit.php", "get_export.php" ); if (!preg_match("/(?:^|\/)([\w\d_]+\.php)\??(.*)/", $REQUEST_URI, $_INSERT THE USER GROUPS NAME HERE_match) || !in_array($_INSERT THE USER GROUPS NAME HERE_match[1], $_INSERT THE USER GROUPS NAME HERE_scripts)) if ($_INSERT THE USER GROUPS NAME HERE_match[1] == 'statistics.php' && $mode == 'logins') |
14. Go to 'Edit Templates -> Single -> home.tpl'
15. Here I set an if statement to show what I wish to show to how ever many user groups I have!
| {if $login eq "master"} { include file="admin/menu_admin.tpl" } {else} {/if} |
And thats all, enjoy!