Change login location based on user group

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

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.

Thats amazing - Thank you so much

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”.