1. dhwvo
  2. General
  3. Friday, April 11 2014, 03:17 AM
How can I add a user field to a "new user account activation email"? I would like to add the country field to the email which I receive in order to activate new accounts. Because I have to send the email further to the person who has an overview in this country. Up to now I have always to go to the webpage log me into the backend in order to find out from which country this person is comming from.
Accepted Answer
admin Accepted Answer
Admin
I wrote something wrong:
                $mailSender='email_of_site@domain.com';
$mailSenderName='Name of Site';
$mailReceiver='your_admin_email'; // changed, the receiver is administrator not user
$mailSubject='New User Data';
$mailBody='Name: '.$data['name']."\n\nCountry: ".$data['your_country_field_alias'];

// Send Email
JFactory::getMailer()->sendMail(
$mailSender, // Sender Mail
$mailSenderName, // Sender Name
$mailReceiver, // Receiver Mail
$mailSubject, // Subject Mail - Changed wrong variable name (previous $emailSubject)
$mailBody // Body Mail - Changed wrong variable name (previous $emailBody)
);
  1. more than a month ago
  2. General
  3. # Permalink
admin Accepted Answer
Admin
Hi Daniel,
sorry for late reply, we will try to find a solution. Sorry but not possible, the activation email is managed from Joomla com_users component.

But you can create a simple plugin to send email with user data when user do a registration.

When an user registers on you site you will receive 2 email (activation and user data).

our documentation:
https://www.easy-profile.com/docs/44-triggers.html

the code to implement (not tested)
defined('_JEXEC') or die;

class PlgJsnSkeleton extends JPlugin
{
function triggerProfileUpdate($user,$data,$changed){

$mailSender='email_of_site@domain.com';
$mailSenderName='Name of Site';
$mailReceiver=$data['email'];
$mailSubject='New User Data';
$mailBody='Name: '.$data['name']."\n\nCountry: ".$data['your_country_field_alias'];

// Send Email
JFactory::getMailer()->sendMail(
$mailSender, // Sender Mail
$mailSenderName, // Sender Name
$mailReceiver, // Receiver Mail
$emailSubject, // Subject Mail
$emailBody // Body Mail
);

return true;

}
}
  1. more than a month ago
  2. General
  3. # 1
dhwvo Accepted Answer
Hi,
thanks for this code. I tried it out but i think i don't know how to do it. I coppied the code without the first three lines into your usergroups.php between "
function triggerProfileUpdate($user,$data,$changed){
" and "
// Conditions
". I replaced the fields: email_of_site@domain.com, Name of Site, email, your_country_field_alias. What did I do wrong? Should I have replaced other fields as well? Should I have put the code somewhere else? When I created an account I also got the message that the Body is empty.
Can you assist?
Many thanks
References
  1. http://members-srac.de
  1. more than a month ago
  2. General
  3. # 2
dhwvo Accepted Answer
Thanks, it's working!
  1. more than a month ago
  2. General
  3. # 3
dhwvo Accepted Answer
Could you tell me how to add two mail recipiens?
  1. more than a month ago
  2. General
  3. # 4
admin Accepted Answer
Admin
Hi,
try to replace Receiver from:
$mailReceiver='your_admin_email';

to
$mailReceiver=array('your_admin_email','second_mail','other_mail');
  1. more than a month ago
  2. General
  3. # 5
  • Page :
  • 1


There are no replies made for this post yet.
However, you are not allowed to reply to this post.
Sorry, the discussion is currently locked. You will not be able to post a reply at the moment.