How to make all registered customers in 3.0 go to a specific user group

I wanted to know if it is possible to make all customers that register on my site automatically go to a specific user group?

If they have registered for a usergroup the code below will send them directly to that usergroup when they next log in. Though you would have to add this for each user and category/usergroup



in controllers/common/auth.php

find this


if (defined('AJAX_REQUEST') && Registry::get('settings.General.one_page_checkout') == 'Y') {
$redirect_url = "checkout.checkout";
} elseif (!empty($_REQUEST['return_url'])) {
$redirect_url = $_REQUEST['return_url'];
}





replace with this but change USERGROUP_ID and CATEGORY_ID with your values.



if (in_array(USERGROUP_ID, $_SESSION['auth']['usergroup_ids'])) {
$redirect_url = "categories.view&category_id=CATEGORY_ID";
} elseif (defined('AJAX_REQUEST') && Registry::get('settings.General.one_page_checkout') == 'Y') {
$redirect_url = "checkout.checkout";
} elseif (!empty($_REQUEST['return_url'])) {
$redirect_url = $_REQUEST['return_url'];
}


so if your usergroup id was 3 and category id was 93 your code would look like this



if (in_array(3, $_SESSION['auth']['usergroup_ids'])) {
$redirect_url = "categories.view&category_id=93";
} elseif (defined('AJAX_REQUEST') && Registry::get('settings.General.one_page_checkout') == 'Y') {
$redirect_url = "checkout.checkout";
} elseif (!empty($_REQUEST['return_url'])) {
$redirect_url = $_REQUEST['return_url'];
}






Create a file called meta.post.tpl with the below content but replace BOTH category_id with your category id




{if ($controller == "categories" && $mode == "view" && $category_data.category_id == CATEGORY_ID) || ($controller == "products" && $mode == "view" && $product.main_category == CATEGORY_ID)}

{/if}


and save it in



skins/basic/customer/addons/my_changes/hooks/index



then clear your cache





John

Will this also work in version 4.0?