I have modified my J1.7.2 so that it will send the SuperAdmins with "Receive system emails" enabled when users activate their account.
Find the following code in components/com_users/models/registration.php (about line 155)
Code:
else
{
$user->set('activation', '');
$user->set('block', '0');
and add the following into the "else".
Code:
// Send email to admins
$uri = JURI::getInstance();
jimport('joomla.user.helper');
// Compile the admin notification mail values.
$data = $user->getProperties();
$data['activation'] = JUtility::getHash(JUserHelper::genRandomPassword());
//$user->set('activation', $data['activation']);
$data['siteurl'] = JUri::base();
$base = $uri->toString(array('scheme', 'user', 'pass', 'host', 'port'));
$data['activate'] = $base.JRoute::_('index.php?option=com_users&task=registration.activate&token='.$data['activation'], false);
$data['fromname'] = $config->get('fromname');
$data['fromname'] = $config->get('fromname');
$data['mailfrom'] = $config->get('mailfrom');
$data['sitename'] = $config->get('sitename');
//$user->setParam('activate', 1);
$emailSubject = JText::sprintf(
'COM_USERS_EMAIL_ACTIVATE_WITH_ADMIN_ACTIVATION_SUBJECT',
$data['name'],
$data['sitename']
);
$emailBody = JText::sprintf(
'COM_USERS_EMAIL_ACTIVATE_WITH_ADMIN_ACTIVATION_BODY',
$data['sitename'],
$data['name'],
$data['email'],
$data['username'],
$data['siteurl'].'index.php?option=com_users&task=registration.activate&token='.$data['activation']
);
// get all admin users
$query = 'SELECT name, email, sendEmail' .
' FROM #__users' .
' WHERE sendEmail=1';
$db->setQuery( $query );
$rows = $db->loadObjectList();
// Send mail to all superadministrators id
foreach( $rows as $row )
{
$return = JUtility::sendMail($data['mailfrom'], $data['fromname'], $row->email, $emailSubject, $emailBody);
// Check for an error.
if ($return !== true) {
$this->setError(JText::_('COM_USERS_REGISTRATION_ACTIVATION_NOTIFY_SEND_MAIL_FAILED'));
return false;
}
}
to
The admins will receive the same email as if activation is set to "admin", you just don't need to actually do the activation.
The code that is inserted is borrowed from the "admin" section. If you want to be fancy, you can change the strings sent in the email.