Joomla User Profile Plugin

Avatar
  • Answered
Hi
In my registration form i added the user profile plugin to collect other user informations, what i want to know if possible is how to add these fields to the Admin notification email that actually shows only the username and name of the registered user.

Thanks
Avatar
JacobIMH
Hello puntogenius, and thanks for your question. Unfortunately from what I can tell, I don't believe it's possible to alter your administrative email notifications to also include other information aside from their name, username, and siteurl. This is because in the /components/com_users/models/registration.php Joomla file it's setting these 3 values as the only ones from the database with this section of code:

//Send Notification mail to administrators
if (($params->get('useractivation') < 2) && ($params->get('mail_to_admin') == 1)) {
$emailSubject = JText::sprintf(
'COM_USERS_EMAIL_ACCOUNT_DETAILS',
$data['name'],
$data['sitename']
);

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

This correlates to the same COM_USERS_EMAIL_REGISTERED_NOTIFICATION_TO_ADMIN_BODY option in either the /language/overrides/en-GB.override.ini or /administrator/language/en-GB/en-GB.com_users.ini file, which look like this:

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

Unfortunately adding another %s variable replacement string in this setting does not allow for any new data to get passed, and it actually breaks the admin notifications from my testing. The other data entered in by the Joomla User Profile plugin ends up in the jos_user_profiles database table, instead of the jos_users table where the registration.php script is setup to pull from. So you would need to make some heavy modifications to the core Joomla scripts to get it to pull in other data for your admin notifications from what I can tell. Please let us know if you had any other questions at all. - Jacob