Page 1 of 1

Notification email not received after new user registration

Posted: Fri Oct 28, 2011 7:04 pm
by publimedia01
I have a problem: Super User is not receiving notification emails when a new user is registering.

My configuration is as follows:

- Joomla version: 1.7.0.
- Super User Profile > Receive System emails: Yes
- Users Manager Options (Users Configuration) > New User Account Activation: Self
- Global Configuration > Server > Mail Settings > Mailer: PHP Mail

1. When a new user is registered Super User is not notified by email, but the new user receives the activation email and the registration works properly. The only problem is that Super User is not aware of the fact that a new user has registered because he doesn’t receive any email.

2. If I change "New User Account Activation" from "self" to "Admin", when a new user is registering the Super User receives a notification email with the activation link of the new user.

3. When a user sends a contact form, the Super User receives the email properly.

I don't think that is a problem of mail settings because in point 2 and 3 the Super User is receiving emails from the webpage.

Can anybody help me to fix this problem?

Thank you for your attention.

Re: Notification email not received after new user registrat

Posted: Fri Oct 28, 2011 7:25 pm
by Webdongle
With 1.7 there are no system emails when 'New User Account Activation: Self'. The Admin only gets an email when 'New User Account Activation: Admin'. Then the admin can chose to Activate the account or not.

Re: Notification email not received after new user registrat

Posted: Fri Oct 28, 2011 8:22 pm
by publimedia01
Thank your for your help, I didn't know that there are no system emails with 'New User Account Activation: Self' on joomla 1.7.0.
I think it could be a good idea for new releases of joomla to give the possibility to receive systems emails also with this user activation option !!
Regards,

Re: Notification email not received after new user registrat

Posted: Fri Oct 28, 2011 8:32 pm
by Webdongle

Re: Notification email not received after new user registrat

Posted: Thu Nov 10, 2011 10:49 pm
by kennywickstrom
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: Select all

        else
        {
            $user->set('activation', '');
            $user->set('block', '0');
and add the following into the "else".

Code: Select all

            // 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.

Re: Notification email not received after new user registrat

Posted: Thu Nov 10, 2011 11:12 pm
by Webdongle
Could you create a diff patch for http://joomlacode.org/gf/project/joomla ... m_id=26206 see what everyone has to say ?

Re: Notification email not received after new user registrat

Posted: Fri Nov 11, 2011 1:51 am
by pearlcaviar
I totally agree with you. We should receive email notification 'cos new registrant could be a bad spammer. Hope the Joomla Developer team will look into it.

Regards,
publimedia01 wrote:Thank your for your help, I didn't know that there are no system emails with 'New User Account Activation: Self' on joomla 1.7.0.
I think it could be a good idea for new releases of joomla to give the possibility to receive systems emails also with this user activation option !!
Regards,

Re: Notification email not received after new user registrat

Posted: Fri Nov 11, 2011 2:48 am
by Webdongle
pearlcaviar wrote:.... Hope the Joomla Developer team will look into it.
...
If kennywickstrom creates a diff patch then it can be put on http://joomlacode.org/gf/project/joomla ... m_id=26206 for testing. The Dev's could decide if they want to use it then.

Re: Notification email not received after new user registrat

Posted: Fri Nov 11, 2011 4:13 am
by kennywickstrom
I have created a new item (http://joomlacode.org/gf/project/joomla ... m_id=27144) since the issue mention previously is closed. I attached a patch to the new issue.

This patch does not really change the email message being sent since that required new language entries.

Re: Notification email not received after new user registrat

Posted: Fri Nov 11, 2011 12:50 pm
by publimedia01
Thank you 'kennywickstrom' for your solution code.

I really hope that joomla developpers team will make this function available in new releases.
There are plenty of ideas around the forum for a better joomla release.

I have personally been working to find some solutions to one of the joomla problems concerning the articles loaded on a Category List and the SEF urls utilization. When you are reading an article which is located on a Category List of a website that is using SEF urls, an you decide to login, you will be returned to a blank page (or an error page if you have installed JCE editor), and not to the article you was reading. I have treated this problem and encourage developpers to find a solution for future releases. For more information read: http://forum.joomla.org/viewtopic.php?f=616&t=672782

Re: Notification email not received after new user registrat

Posted: Fri Nov 11, 2011 7:08 pm
by Webdongle
kennywickstrom wrote:I have created a new item (http://joomlacode.org/gf/project/joomla ... m_id=27144) since the issue mention previously is closed. I attached a patch to the new issue.
....
The other Tracker is still open, but I've set your Tracker as 'Pending' with a note on the original Tracker to the one you created. (It's too complicated an issue for me to test as I don't understand if using the code like that is the best way to achieve it. So will wait to see what the Dev's say).

Thanks for your effort, lets hope they approve.