shepo
July 22, 2021, 3:35pm
1
I would like to change the new user activation email so that the link swaps between …/manager for admins and …/login for members of a user group.
When I create a member the system sends the default email with the manager path.
I have looked at login.Register but this seems to require the user to register them selves
thanks a million
modx 2.8.3
could be done with a plugin at onBeforeUserFormSave
Example Code:
<?php
$message = $modx->getChunk('fbuch_benutzerpasswort_mail',$scriptProperties);
$modx->setOption('signupemail_message',$message);
return;
you could switch the used chunk, depending on which usergroups are set for the user
shepo
July 22, 2021, 7:58pm
3
Thanks but this beyond my knowledge - I thought there was some sort of if else statement but I don’t understand how I inject that into modx property set
that’s the full plugin - code for your case, which should work:
<?php
$data = $modx->getOption('data',$scriptProperties,[]);
$groups = json_decode($modx->getOption('groups',$data,''),true);
$surl = 'domain/login';
if (is_array($groups)){
foreach ($groups as $group){
if ($group['name'] == 'Administrator'){
$surl = 'domain/manager';
}
}
}
$message = $modx->getOption('signupemail_message');
$message = str_replace('[[+surl]]',$surl,$message);
$modx->setOption('signupemail_message',$message);
return;
create a new plugin with this code. Change it to your needs.
Set the system - event onBeforeUserFormSave for this plugin.
shepo
July 23, 2021, 8:34am
5
Thats amazing - Thank you so much
system
Closed
July 25, 2021, 8:34am
6
This topic was automatically closed 2 days after discussion ended and a solution was marked. New replies are no longer allowed. You can open a new topic by clicking the link icon below the original post or solution and selecting “+ New Topic”.