1
GreenFlatDog
Registration emails going everywhere!

With:
System > Preferences Main > User Info Settings

Notify by mail when a new user is registered?* = yes
Select group to which new user notification mail will be sent* = Site Admins
Select activation type of newly registered users* = Requires activation by user (recommended)

I get these emails sent when a new user registers:
1. 'New user registration at mysite' - to Site Admins
2. 'User activation key for new user' - to new user and the Site Admins. (built on template register.tpl)

Clearly the Site Admins shouldn't get email 2

It looks as if the xoopsmailer object gets assigned the Site Admins addresses during (1) and these are not cleared when it is re-used for (2)

Hardly a 'deal-breaker' and hopefully easy to fix.

BTW I think the team have done a wonderful job I haven't stopped clapping since I downloaded!


2
trabis
Re: Registration emails going everywhere!
  • 2009/10/29 21:13

  • trabis

  • Core Developer

  • Posts: 2269

  • Since: 2006/9/1 1


Thanks!
This bug was known by the core team but it was fixed only in profile module. Somehow we missed to fix the core register.php.

You are quite correct in your assumption! The data on Mailer is not being reseted.

Please edit register.php and add this line(around line 196):
if ($xoopsConfigUser['new_user_notify'] == && ! empty($xoopsConfigUser['new_user_notify_group'])) {
                
$xoopsMailer =& xoops_getMailer();
                
$xoopsMailer->reset(); //add this line please
                
$xoopsMailer->useMail();


3
GreenFlatDog
Re: Registration emails going everywhere!

Thanks for picking this up.
I should have said I was using the Profile module! So I tested your suggestion with profile de-activated to see what happens and doing a 'reset' around line 196 does the business for the core stuff.

Coming back to using the profile module I think we need a similar reset in profile/register.php just after line 228
} else if ($GLOBALS['xoopsConfigUser']['activation_type'] == 0) {
                
$xoopsMailer =& xoops_getMailer();
                
$xoopsMailer->reset(); // added by GFD Oct 2009 to prevent 'activation' emails going 'notify group'
                
$xoopsMailer->useMail();
                
$xoopsMailer->setTemplate('register.tpl');
                
$xoopsMailer->assign('SITENAME'$GLOBALS['xoopsConfig']['sitename']);


That seems to send out the correct emails.

4
trabis
Re: Registration emails going everywhere!
  • 2009/10/30 13:55

  • trabis

  • Core Developer

  • Posts: 2269

  • Since: 2006/9/1 1


Thanks again GreenFlatDog!

Your fix was commited on SVN, revision 3821

5
ghia
Re: Registration emails going everywhere!
  • 2009/11/3 22:35

  • ghia

  • Community Support Member

  • Posts: 4953

  • Since: 2008/7/3 1


When you create a user in admin, the user gets a welcome message. This is not the case when creating a user with eg the profile module.
I think it could be resolved by placing a
XoopsUserUtility::sendWelcome($user);

between
if ( $user->isNew()  ) {
  
redirect_header('user.php'2_PROFILE_AM_USERCREATEDfalse);

in modules/profile/admin/user.php

6
GreenFlatDog
Re: Registration emails going everywhere!

I wonder if Ghia's idea could be improved?

One extra benefit or adding users in profile/admin over sytem/admin is that you can choose whether to add the user as 'active' or 'inactive'.

I can imagine it could be useful to add many users at the same time but leave them 'inactive' - which is the default on the screen anyway. Sending out the welcome message to inactive users would seem wrong, it would be better when the user was activated later.

If a user had been active in the past and for some reason a site admin had de-activated them, then when the user was re-activated it would be helpful to re-send the welcome message, particularly if it includes the disclaimers etc.

So how about changing (around line 107 in ../profile/admin/user.php)
if ( isset($_POST['level']) && $user->getVar('level') != intval($_POST['level'])  ) {
    
$user->setVar('level'intval($_POST['level']) );
}


to
if ( isset($_POST['level']) && $user->getVar('level') != intval($_POST['level'])  ) {
    
$userLevelChange true;    
    
$user->setVar('level'intval($_POST['level']) );
}


and later changing
if ( $user->isNew()  ) {
    
redirect_header('user.php'2_PROFILE_AM_USERCREATEDfalse);
} else {
    
redirect_header('user.php'2_US_PROFUPDATEDfalse);
}

to
if ( $user->isNew()  ) {
    if (
$user->getVar('level')) {
        
XoopsUserUtility::sendWelcome($user);
    }
    
redirect_header('user.php'2_PROFILE_AM_USERCREATEDfalse);
} else {
    if (
$userLevelChange && $user->getVar('level')) {
        
XoopsUserUtility::sendWelcome($user);
    }
    
redirect_header('user.php'2_US_PROFUPDATEDfalse);
}


Login

Who's Online

344 user(s) are online (194 user(s) are browsing Support Forums)


Members: 0


Guests: 344


more...

Donat-O-Meter

Stats
Goal: $100.00
Due Date: Nov 30
Gross Amount: $0.00
Net Balance: $0.00
Left to go: $100.00
Make donations with PayPal!

Latest GitHub Commits