Welcome the Technical Support section. Help us in assisting you by providing us with a concise and descriptive elaboration of your issues. Be specific and if possible, provide us with a step-by-step instruction in replicating your problem.
Bug - administrator email is sent when self registration is assigned
ISSUE SUMMARY:
When there are no fields in the profile and no profile types or multiprofile enabled, the administrator approval email gets sent when com_users configuration is set to self register.
This happens in controllers/register.php when register_save() is called after the initial register screen is set.
if the following code is true
if (count($fields) <= 0 && (!$profileTypes || !$config->get('profile_multiprofile')))
it will send the 'registration' email by calling $this->sendEmail()
inside sendEmail() the following switch occurs:
case 'registration' :
// This section will only be called when there are no custom fields created and we just proceed like how Joomla
// registers a user.
if ($requireApproval || $com_user_activation_type == 1) {
$message = JText::sprintf(
'COM_COMMUNITY_EMAIL_REGISTRATION_REQUIRES_ACTIVATION',
$name,
$sitename,
$activationURL,
$siteURL,
$username,
$password
);
$com_user_activation_type ==1 is actually self register, not admin approve.
You can verify by making sure the com_users optinos are set to self register and verify this value. The fix is to simply make this test a $com_user_activation_type == 2.
Another similar bug is found where the COM_COMMUNITY_EMAIL_REGISTRATION_COMPLETED_REQUIRES_ACTIVATION
email is sent even if the user has been approved, invited (via invitex), or if the activation in com_users is set to "none".
case 'registration_complete' :
if ($requireApproval || $com_user_activation_type == 2) {
// if approval is required, send an email to both admin and user, admin - to activate the user, user - to wait for admin approval
/* @since 4.1, there is a new requirement to send the activation to user to make sure the email is valid first before letting admin verify the account
*
* so we will make the user activate first but still in disabled state
*
* */
$activationURL = $baseUrl . 'index.php?option=' . COM_COMMUNITY_NAME . '&view=register&task=verifyemail&' . ACTIVATION_KEYNAME . '=' . $user->get(
'activation'
);
$message = JText::sprintf(
'COM_COMMUNITY_EMAIL_REGISTRATION_COMPLETED_REQUIRES_ADMIN_ACTIVATION',
$name,
$sitename,
$activationURL
);
} else {
$message = JText::sprintf(
'COM_COMMUNITY_EMAIL_REGISTRATION_COMPLETED_REQUIRES_ACTIVATION',
$name,
$sitename,
$activationURL,
$siteURL
);
}
break;
This needs to have a condition if $com_user_activation_type ==0 which sends out the following (from en-GB.com_community.ini)
COM_COMMUNITY_EMAIL_REGISTRATION_COMPLETED="Hello %s,\n\nThank you for registering at %s.\n\nYou may now log in to %s using your username and password."
and modify this file language/en-GB/en-GB.com_community.ini, find this code :
COM_COMMUNITY_EMAIL_REGISTRATION_REQUIRES_ACTIVATION="Hello %s,\n\nThank you for registering at %s. Your account is created and must be activated before you can log in.\nTo activate the account, click on the following link or copy-&-paste it in your browser:\n\t<a href=_QQQ_%3$s_QQQ_>%3$s</a>\n\nAfter activation you may login to %s using the following username and password:\n\nUsername: %s\nPassword: %s"
and replace to :
COM_COMMUNITY_EMAIL_REGISTRATION_REQUIRES_ACTIVATION="Hello %1$s,\n\nThank you for registering at %2$s. Your account is created and must be activated before you can log in.\nTo activate the account, click on the following link or copy-&-paste it in your browser:\n\t<a href=_QQQ_%3$s_QQQ_>%3$s</a>\n\nAfter activation you may login to %4$s using the following username and password:\n\nUsername: %5$s\nPassword: %6$s"