0

The website requires administrator approval of users but I need the email to the admin to contain not just the name and email address of the new user but also all the other details in the login form.

I have this registration form and it looks like this: registration form

How do I make the auto-email send all these details? Where do I look?

Thanks.

1 Answer 1

1

You must edit file /components/com_user/models/registration.php line 549

$emailBodyAdmin = JText::sprintf(
    'COM_USERS_EMAIL_REGISTERED_NOTIFICATION_TO_ADMIN_BODY',
    $data['name'],
    $data['username'],
    $data['siteurl']
);

The template is on /languages/your-language/your-language.com_users.ini (ex: /languages/en-GB/en-GB.com_users.ini) seek for COM_USERS_EMAIL_REGISTERED_NOTIFICATION_TO_ADMIN_BODY define

COM_USERS_EMAIL_REGISTERED_NOTIFICATION_TO_ADMIN_BODY="Hello administrator, \n\nA new user '%s', username '%s', has registered at %s."

first $s is $data['name'], second $s is $data['username'], etc.

So, if you want to add password:

$emailBodyAdmin = JText::sprintf(
    'COM_USERS_EMAIL_REGISTERED_NOTIFICATION_TO_ADMIN_BODY',
    $data['name'],
    $data['username'],
    $data['siteurl'],
    $data['password_clear']
}

Then

COM_USERS_EMAIL_REGISTERED_NOTIFICATION_TO_ADMIN_BODY="Hello administrator, \n\nA new user '%s', username '%s', has registered at %s with password:%s."

You can also add all $data contents

foreach($data as $key=>$value) {
    $emailBodyAdmin .= $key." = ".$value."\n";
}

Or write custom $emailBodyAdmin field by field.

5
  • Thanks but... It didn't work. I tried both. The first one doesn't change anything on the email. It still looks the same. The second one, all $data, gave me this: Parse error: syntax error, unexpected T_FOREACH in /hermes/bosnaweb17a/b1866/ipg.glenatgrandviewcom/joomla33/components/com_users/models/registration.php on line 523.
    – Jae
    Apr 25, 2016 at 8:08
  • Any other way, please? I would greatly appreciate it.
    – Jae
    Apr 25, 2016 at 8:15
  • What is your joomla version?, Apr 25, 2016 at 9:47
  • It's started with Joomla! 3.3 now it's Joomla! 3.4.7.
    – Jae
    May 4, 2016 at 6:24
  • Consider that this may be a security risk as email is not a secure form of communication. I would advise against this functionality and I turn it off by default in Joomla!
    – Eoin
    Nov 18, 2016 at 19:44

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.