•  What We Do
  •  What We Can Do For You
  •  How We Do It
  •  About Us
  •  Blog
  •  Search
  •  Client Login

1.818.524.2500


Reply to comment


How to create your own custom User Groups in X-Cart

Submitted by nej on Thu, 10/22/2009 - 18:00
  • Custom User Groups
  • XCart

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

Quote:
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))
func_header_location("error_message.php?access_den ied&id=37");

if ($_fulfillment_match[1] == 'statistics.php' && $mode == 'logins')
func_header_location("error_message.php?access_den ied&id=37");
}

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

Quote:
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))
func_header_location("error_message.php?access_den ied&id=37");

if ($_fulfillment_match[1] == 'statistics.php' && $mode == 'logins')
func_header_location("error_message.php?access_den ied&id=37");
}

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))
func_header_location("error_message.php?access_den ied&id=37");

if ($_fulfillment_match[1] == 'statistics.php' && $mode == 'logins')
func_header_location("error_message.php?access_den ied&id=37");
}

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

Quote:
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))
func_header_location("error_message.php?access_den ied&id=37");

if ($_INSERT THE USER GROUPS NAME HERE_match[1] == 'statistics.php' && $mode == 'logins')
func_header_location("error_message.php?access_den ied&id=37");
}

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!

Quote:
{if $login eq "master"}
{ include file="admin/menu_admin.tpl" }
{else}

{/if}


And thats all, enjoy!

Take your first step in building a better competitive edge by contacting us today.

»
  • nej's blog

Reply

The content of this field is kept private and will not be shown publicly.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Allowed HTML tags: <a> <em> <strong> <cite> <code> <ul> <ol> <li> <dl> <dt> <dd>
  • Lines and paragraphs break automatically.

More information about formatting options

CAPTCHA
This question is for testing whether you are a human visitor and to prevent automated spam submissions.
4 + 1 =
Solve this simple math problem and enter the result. E.g. for 1+3, enter 4.

Copyright © 2011 by Venarc Corporation. All rights reserved. Venarc and Venarc logo are trademarks of Venarc Corporation.