I am setting user groups using your example and it works fine when inputting static values
But when I try to pull the array data it just gives me an incorrect usergroup error, I am tryin to replace
with something like below, OrgData is the Model ID from a read db in Load
I know its something small but not sure what, can someone help? Thanks!!
<?php
if ( !isset($form->data['OrgID']) || !$form->data['OrgID'] ) {
// there is no division selected
return false;
}
If ( $form->data['UserType'] = 1 ){
$group_array = array (
'1' => '29',
'2' => '33',
'5' => '47',
'4' => '29',
'9' => '27',
'6' => '22',
);
}
$group_id = $group_array[$form->data['OrgID']];
$user_id = $form->data['_PLUGINS_']['joomla_registration']['id'];
jimport( 'joomla.user.helper' );
JUserHelper::addUserToGroup($user_id, $group_id);
?>
But when I try to pull the array data it just gives me an incorrect usergroup error, I am tryin to replace
$group_array = array (
'1' => '29',
'2' => '33',
'5' => '47',
'4' => '29',
'9' => '27',
'6' => '22',
);
with something like below, OrgData is the Model ID from a read db in Load
$group_array = array ();
foreach ( $form->data['OrgData'] as $d ) {
$group_array[$d['ID']] = $d['DancerGP'];
}
I know its something small but not sure what, can someone help? Thanks!!