Forums

How to create custom activation email?

goliath 24 Jul, 2013
I use my own custom registration form created with Chronoforms.
Everything works nice but what I want is to create my own activation email (and not the 'unprofessional' look of the standard Joomla activation email). Can I do this with Chronoforms?
Thanks in advance.

Regards
Geert
GreyHead 24 Jul, 2013
Hi geert,

You can turn off the Joomla! emails in the Joomla! Registration action; then use a Custom Code action to build a validation link of your own pointing to a new event in your form and include that into the template of an email action.

Here's the code I use to build a validation link
<?php
$token = $form->data['_PLUGINS_']['joomla_registration']['activation'];
$form->data['vlink'] = JURI::root().'index.php?option=com_chronoforms&chronoform=form_name_here&event=event_name_here&token='.$token;
?>
Replace form_name_here and event_name_here with the names of your form and event; then add {vlink} in the email template.

Use the Joomla! Activation action to validate the user in the validation event.

Bob
squawk 04 Dec, 2013
Hi

I#'m trying to follow the above instructions but I'm getting the following within the client email:
http://1068136658.n52720.test.prositehosting.co.uk/index.php?option=com_chronoforms&chronoform=user_registration;event=check_email&token=


with the form link producing the following on the site
There is no form with this name or may be the form is unpublished, Please check the form and the url and the form management.

Any ideas?

Many Thanks
GreyHead 04 Dec, 2013
Hi squawk,

That URL needs to include &chronoform=user_registration&event=check_email there's just a ; in the version you posted.

Bob
squawk 04 Dec, 2013
Hi Bob

Many thanks
The link now take the user to the site without an error page however the form (or any other page) is not displayed. Just the site's header and footer. I have also notice that the $token variable doesn't appear to be at the end of the completed link.
Also if I wish to include an activation link within an admin email that is sent at the same time, would this be the same code?

Many, many thanks once again Bob.
GreyHead 04 Dec, 2013
Hi squawk,

It should be OK provided that this Custom Action is after the Joomla! Registration action; to see exactly what is happening add a Debugger action (or more than one in different places). That will show you what values are being set and where.

Does your form have a check_email event? and does the event show any output? If not then there is nothing to see.

Bob
squawk 04 Dec, 2013
Hi Bob
Yes it does have a check email event to check if the email address in question is already used.
It is to this custom code I added you vlink code in an if else condition.
And it is before the Joomla! Registration action as I've got the email sending from the on success area of the registration action.
GreyHead 04 Dec, 2013
Hi squawk,

The token doesn't have any value before the Joomla! Registration action :-( The Custom Code has to be after the action. You can try putting it in the On Success event before the email though personally I try not to use the On Success events but put actions in the main parent event.

Bob
squawk 04 Dec, 2013
Hi Bob

Just tried that, the vlink then doesn't resolve and the email just contains 'vlink'!
Would you suggest that I should remove the email generation from the registration action and have the custom followed by the email action after and separate from the registration?
And thank you once again. :-)
GreyHead 04 Dec, 2013
Hi squawk,

Check with a Debugger after the Joomla! Registration action to make sure that the token is being set. It is it then I'd set up the actions as:
. . .
Joomla! Registration 
  + On Success (empty)
  + On Fail 
    Event Loop (or something)
Custom Code
Email
. . .

Bob
squawk 04 Dec, 2013
Hi once again

The suggestion below is exactly the point I have now reached, and the $token is now being resolved. However the page still goes to a page dispalying only the header and footer and doesn't send the admin the verify email?
GreyHead 04 Dec, 2013
Hi squawk,

Please add a debugger to the Check Email event to see exactly what is happening there.

Bob
This topic is locked and no more replies can be posted.