Is it possible to customize the registration email depending on the role choosed by the user?

Is there any variable in the !username which could be used to send one or another message or i should patch the .module?

Thanks in advance,
regards.

Comments

menoseficaz’s picture

I'm looking for the same thing - seems like it would be a common request with this module. Let me know if you come up with a hack and please post it here. Thanks!

cyberswat’s picture

Version: » 6.x-1.x-dev
Category: support » feature

I'm going to move this over to a feature request.

manoloka’s picture

I subscribe.

I think it's a must for this module.

Thanks, great module BTW

AmitV-2’s picture

Subscribing

pipesd’s picture

Subscribing

Michsk’s picture

subscribing, this is a module with lot of potential

cyberswat’s picture

Status: Active » Closed (won't fix)

I think this is a good idea but am not going to support it without additional support from the community in the form of patches.

fuerst’s picture

Status: Closed (won't fix) » Needs review
StatusFileSize
new6.57 KB

Please review the attached patch which provides the function described in the issue.

It uses hook_mail_alter() to replace the Welcome email generated by the user.module with role dependent text.

After applying the patch and running update.php you can configure the Subject and Body of the Welcome email for every role independently in the Assign from path section of the Auto Assign Role settings page.

I'm not sure if my approach to overwrite the email body generated by the user.module will work for every situation. I currently just overwrite the first element of the $message['body'] array. Once another module uses hook_mail_alter() to add more text to the $message['body'] array and reorders its elements my approach may fail. Feel free to suggest a solution if you have one.

I also decided to overwrite every Welcome email regardless of it's type which are

  • Welcome, user created by administrator
  • Welcome, no approval required
  • Welcome, awaiting administrator approval

I think that's ok because once you use the Email customization feature provided by this patch you exactly know what email text you want to send your users.

Note: From within the autoassignrole module directory use the -p1 switch to the patch command to apply this patch.

Status: Needs review » Needs work

The last submitted patch, autoassignrole-267848-8.patch, failed testing.

cyberswat’s picture

Status: Needs work » Needs review

@fuerst the patch failed to apply in automated testing likely due to needing the -p1 instead of a -p0 ... can you correct this?

fuerst’s picture

StatusFileSize
new6.55 KB

Here it is.

fuerst’s picture

StatusFileSize
new6.49 KB

Corrected patch: replacement of email subject or body only takes place if it is not empty. That way you can leave the body field empty and get the subject still replaced.

fuerst’s picture

I do have this patch working well at a production site.
Does it get a chance to get into the next release?

cyberswat’s picture

Just waiting on someone to verify that it has been RTBC and is ready to go and it will be committed.

ethnovode’s picture

Hello,

I use autoassignrole with no automatic role but I let the user choose his role with radio buttons. I would love this feature but after looking at your patch it seems that it only works if I set the role to be automatic. Would it be possible to put this (very nice) option in a new fieldset and let it available so we can use it even if you don't have the assignment automatic ?

fuerst’s picture

Would it be ok to set the role dependent email messages regardless of any assigning mode (path, automatic or user choosen).

@cbyerswat: What do you think about this? Doesn't make sense to implement the feature when it will not be included, of course.

itserich’s picture

Any word on this? With all the user modules I am surprised there is no way to send a message customized per role.

Ela’s picture

subscribing

chuckbar77’s picture

subscribing

emergencyofstate’s picture

subscribing. Is this functionality planned for the 7 version as well? I'm using that one.

fuerst’s picture

Just set the Status of this issue to "reviewed & tested by the community" if the patch works for you. That way the maintainer knows it is working and may include it in the next release.

xbery’s picture

#12: autoassignrole-267848-12.patch queued for re-testing.

Enemy’s picture

#11: autoassignrole-267848-11.patch queued for re-testing.

chinita7’s picture

subscribing