I have a registration form that does a whole bunch of stuff in hooks etc... :
[[!Register?
&submitVar=`login-register-btn`
&preHooks=`aiRequired,ciRequired,RegisterProfilePreHook,mcSubscribePreHook,profileEditCheckBoxes,`
&postHooks=`RegisterUserGroup`
&activationResourceId=`211`
&activationEmailTpl=`lgnCustomActivateEmailTpl`
&activationEmailSubject=`Thanks for Registering!`
&activationttl=`1440` &submittedResourceId=`212`
&usernameField=`username`
&passwordField=`password`
&emailField=`email`
&customValidators=`agreeEULA`
&validate=`a bunch of stuff...`
]]
the post hook "RegisterUserGroup" assigns a person a group & role based on a combination of form selections during registration.....
// snippet.RegisterUserGroup.php
$specialty = $hook->getValue('specialty');
$country = strtolower($hook->getValue('excountry'));
$username = $hook->getValue('username');
$staff = $hook->getValue('staff-or-resident'); //Staff | Resident
$joingroup = '';
$joinrole = '';
switch ($specialty){
case 'Medical Oncologist / Hematologist' :
if($country == 'canada'){
if($staff == 'Staff'){
$joingroup = 2; // Canadian Medical Oncologists
$joinrole = 3; // Staff Role
}else{
$joingroup = 3; // Canadian Resident
$joinrole = 5; // Resident Role
}
}else{
if($staff == 'Staff'){
$joingroup = 5; // Int Med Onc
$joinrole = 7; // IntMedOnc Role
}else{
$joingroup = 17; // International Resident
$joinrole = 5; // Resident Role
}
}
break;
case 'Other' :
$joingroup = 15; // Other
$joinrole = 1; //member
break;
case 'Surgical/Radiation Oncologist' :
$joingroup = 9; // Surgical/Radiation Oncologist
$joinrole = 8; // Other HC Professional Role
break;
case 'Palliative Care Specialist (Oncology)' :
$joingroup = 10; // Palliative CAre Specialist
$joinrole = 8; // Other HC Professional Role
break;
case 'General Practitioner in Oncology (GPO)' :
$joingroup = 11; // General Practitioner in Oncology
$joinrole = 8; // Other HC Professional Role
break;
case 'General Practitioner' :
$joingroup = 12; // General Practitioner
$joinrole = 8; // Other HC Professional Role
break;
case 'Nurse' :
$joingroup = 13; // Nurse
$joinrole = 8; // Other HC Professional Role
break;
case 'Pharmacist' :
$joingroup = 14; // Pharmacist
$joinrole = 8; // Other HC Professional Role
break;
default :
$joingroup = '0'; // none
$joinrole = '0'; // none
break;
}
if($joingroup > 0 && $joinrole > 0){
$user = $modx->getObject('modUser', array('username'=>$username));
$user->joinGroup($joingroup, $joinrole);
if(!$user->save()){
return false;
};
}
return true;
Cool, works, no problem, BUT, now I need to block users who select specific groups so that they can't activate their account [i.e. till an admin reviews their registration]
So, am I able to send users who I block in the posthook a different activation email than users who are not blocked, i.e. an email without the activation links in it. [if so, how?]
-thanks
-sean