I was looking for a way to send the activation email to another email address that is not the new users main email.
Any thoughts?
I am using:
Login plugin
https://docs.modx.com/extras/revo/login/login.register
MODx version 2.7.2
I was looking for a way to send the activation email to another email address that is not the new users main email.
Any thoughts?
I am using:
Login plugin
https://docs.modx.com/extras/revo/login/login.register
MODx version 2.7.2
You could create a second (hidden) email field with the desired email address in it and use the &emailField
property in your call to use that email to send the activation to.
Unless I am missing something i believe any email that is put in the field &emailField
automatically becomes the primary email for the new user, so that wouldnt work
That might be right, didn’t think about that. If that’s the case, you probably have to use &preHooks
and call a custom snippet sending an email to your desired address.
Not really an answer - but what’s the use case you have in mind? Maybe there’s a better way to go about it.
need to have users register for a service and have there accounts not activate until the site owner activates them
Thinking about this, the activation link is needed by the admin, to make it easy to activate the user, but the activation email itself doesn’t seem to be necessary.
Just thinking that you could disable the sending of the email to the new user somehow, and grab the activation link in a posthook…then ship an email to the admin with the link and any other info from the registration form that would be useful
Just thinking out loud
Some similar threads on the old forum:
https://forums.modx.com/thread/44830/manual-activation
There’s also this tutorial in the documentation but I haven’t personally tried that:
https://docs.modx.org/current/en/extras/login/login.tutorials/request-membership
If I’m understanding you, you want this: ActivationEmail Plugin.
Just set the Register plugin not to send an email and one will be sent automatically when the admin activates the user. Optionally, you can also have an email sent when the user is deactivated.
thanks, i shall look into those
I didn’t know about the ActivationEmail Plugin, which is certainly worth a look. However, my understanding is that it will allow you to automatically send an email when you activate a user, but it will not ensure your administrators are informed of the registration request.
On one site we are managing, we used the &activationEmail parameter of the login.register snippet to send an email to the users administrators. I don’t think login.register can send an email to multiple persons, but in our case, we defined an email address which forwarded the received emails to multiple recipients.
Our login.register snippet call (on the register page) looks like this (I obfuscated the domain name for privacy)::
[[!Register?
&activationEmail=`usermoderators@xxx.ch`
&activationEmailSubject=`User registration request`
&activationResourceId=`144`
&placeholderPrefix=`reg.`
&postHooks=`register.postHook`
&preHooks=`register.preHook`
&submittedResourceId=`143`
&submitVar=`registerbtn`
&usergroups=`Members`
&validate=`nospam:blank,
fullname:required,
address:required,
zip:required,
city:required,
email:required:email,
username:required:minLength=^4^,
password:required:minLength=^4^,
password_confirm:password_confirm=^password^`
]]
As you see, we set &activationEmail='usermoderators@xxx.ch
, which receives the request emails and then redirect the emails to our administrators group.
The register.prehook and register.posthook snippets are used by us in order to allow the users to upload a profile picture.
I can’t think of any reason why you can’t use both Register and ActivationEmail. You can leave Register as is to notify the admins, then ActivationEmail will email the new users when the user moderator activates them.
As @bobray says, you will need the ActivationEmail or another solution in order to notify the user that the account was approved/activated.
I don’t think the Modx system or Register has that function at all. Hmm could be wrong on this…
Looks to me like your solution is good, do be careful about the time limitation on the activation link, you’re probably going to want your admins to have a defined period to click, otherwise they would have to log into the manager and manually activate the account…anyway it would slow things down if that link expires
Thanks, that works. As far as i can see the parameter &activationEmail
is not in the documentation strangely enough.
Agreed, that was my plan
This is the relevant code in the Register processor:
if ($activation && !empty($email) && !empty($activationResourceId) && !$moderated) {
$this->sendActivationEmail();
}
I think you will need the user’s email to have them register successfully, but if you don’t set the &activationResourceId
property, no email will be sent.
This should stop Register from sending an email:
&activationResourceId=``