Emails when Account is Activated

Temporary forum to obtain support while phpBB.com is offline.
Please use the support forum on phpBB.com
Forum rules
Temporary forum to obtain support while phpBB.com is offline.
Please use the support forum on phpBB.com
Locked
robdocmagic
Registered User
Posts: 7
Joined: Mon Feb 02, 2009 4:26 pm

Emails when Account is Activated

Post by robdocmagic »

Hello,

I have my board setup such that I have to activate new users.

I have few options for activating users.

The first is to click on the link in the email I get which launches the /includes/ucp/ucp_activate.php file and then sends out the email to the user (to let them know the account has been activated).

Code: Select all

if ($config['require_activation'] == USER_ACTIVATION_ADMIN && !$update_password)
		{
			include_once($phpbb_root_path . 'includes/functions_messenger.' . $phpEx);

			$messenger = new messenger(false);

			$messenger->template('admin_welcome_activated', $user_row['user_lang']);

			$messenger->to($user_row['user_email'], $user_row['username']);

			$messenger->headers('X-AntiAbuse: Board servername - ' . $config['server_name']);
			$messenger->headers('X-AntiAbuse: User_id - ' . $user->data['user_id']);
			$messenger->headers('X-AntiAbuse: Username - ' . $user->data['username']);
			$messenger->headers('X-AntiAbuse: User IP - ' . $user->ip);

			$messenger->assign_vars(array(
				'USERNAME'	=> htmlspecialchars_decode($user_row['username']))
			);

			$messenger->send($user_row['user_notify_type']);
			$message = 'ACCOUNT_ACTIVE_ADMIN';
		}
The second is to go into the ACP and I can view Inactive Users and then mark them and then select activate and submit. This method (as far as I can tell) calls the includes/acp/acp_inactive.php file.

Code: Select all

if ($config['require_activation'] == USER_ACTIVATION_ADMIN && !empty($inactive_users))
						{
							include_once($phpbb_root_path . 'includes/functions_messenger.' . $phpEx);

							$messenger = new messenger();

							foreach ($inactive_users as $row)
							{
								$messenger->template('admin_welcome_activated', $row['user_lang']);

								$messenger->to($row['user_email'], $row['username']);

								$messenger->headers('X-AntiAbuse: Board servername - ' . $config['server_name']);
								$messenger->headers('X-AntiAbuse: User_id - ' . $user->data['user_id']);
								$messenger->headers('X-AntiAbuse: Username - ' . $user->data['username']);

								$messenger->assign_vars(array(
									'USERNAME'	=> htmlspecialchars_decode($row['username']))
								);

								$messenger->send(NOTIFY_EMAIL);
							}

							$messenger->save_queue();
						}
In looking at the code for each it appears the only material difference is that the ACP uses the "queue" approach to sending mail and the UCP approach sends the email right then and there. Both use the messenger to send the email and both seem to setup the messenger object exactly the same.

When I use the UCP approach it works just fine and my test user gets the email just fine.

When I use the ACP approach I never get the email.

I just setup this board and its just me and my test user accounts. I have test accounts that I setup then activate, etc.

Thanks!!

-Rob

KenH
Registered User
Posts: 3
Joined: Mon Feb 02, 2009 5:46 pm

Re: Emails when Account is Activated

Post by KenH »

Good catch. I recently set a a forum and was unaware of this behavior. I will be monitoring this topic for further information.

Ken

bolverk
I've been banned
Posts: 280
Joined: Mon Feb 02, 2009 5:39 pm

Re: Emails when Account is Activated

Post by bolverk »

robdocmagic wrote:When I use the ACP approach I never get the email.
Last I knew, activating a user from within the ACP does not generate an email. <-by design

robdocmagic
Registered User
Posts: 7
Joined: Mon Feb 02, 2009 4:26 pm

Re: Emails when Account is Activated

Post by robdocmagic »

KenH wrote:Good catch. I recently set a a forum and was unaware of this behavior. I will be monitoring this topic for further information.

Ken
Hi Ken,

If you get a chance can you give it a try in your environment? (e.g. create 2 users and activate one from the email link and the other from from the ACP) and see if you get activation emails for both users.

I am trying to see if its in my environment as all of the code looks like it should work just fine both ways.

Thanks!

-Rob

KenH
Registered User
Posts: 3
Joined: Mon Feb 02, 2009 5:46 pm

Re: Emails when Account is Activated

Post by KenH »

Rob,

I did try it on my install and it functions just as you described.

Ken

robdocmagic
Registered User
Posts: 7
Joined: Mon Feb 02, 2009 4:26 pm

Re: Emails when Account is Activated

Post by robdocmagic »

KenH wrote:Rob,

I did try it on my install and it functions just as you described.

Ken
Thanks Ken! For now I suppose we can just use the emails to activate the users but its also nice to be able to activate many people at once instead of clicking many emails :D

robdocmagic
Registered User
Posts: 7
Joined: Mon Feb 02, 2009 4:26 pm

Re: Emails when Account is Activated

Post by robdocmagic »

bolverk wrote:
robdocmagic wrote:When I use the ACP approach I never get the email.
Last I knew, activating a user from within the ACP does not generate an email. <-by design
Hmmm.. The thing is that I went into the ACP code and it looks like its setting up the email messenger and using the same templates as the UCP does (those are the only 2 places in the entire code base that use the activation email template) ..

I even put my own debug email (using the PHP mail function) in that code (in the ACP) and and activated a user and I got my test message (verifying that code was being executed) -- yet never got the actual activation email for my user.

robdocmagic
Registered User
Posts: 7
Joined: Mon Feb 02, 2009 4:26 pm

Re: Emails when Account is Activated

Post by robdocmagic »

Check this out -- I went into acp_inactive.php and changed the new messenger() to new messenger(false) (to turn off the queuing) and then I commented out the

$messenger -> save_queue();

I believe that this will force it to send the email now instead of queueing it and it worked like it should -- e.g. my test user got the confirmation email that the account was activated when I activated it via the ACP.

Code: Select all


if ($config['require_activation'] == USER_ACTIVATION_ADMIN && !empty($inactive_users))
{
   include_once($phpbb_root_path . 'includes/functions_messenger.' . $phpEx);

   $messenger = new messenger(false); // add false to force to send versus queue
   foreach ($inactive_users as $row)
    {
      ... 
      $messenger->send(NOTIFY_EMAIL);
    }

   // $messenger->save_queue(); // remove this as its n/a
}




User avatar
lanesharon
Registered User
Posts: 20
Joined: Wed Apr 12, 2006 7:16 pm

Re: Emails when Account is Activated

Post by lanesharon »

I just did the same thing. My board is setup for Admin activate. I did a 'force reactivation' on my test account. The email to activate was sent out to the user, not the Admin (kind of odd behavior for an Admin Activate board). Then, I used the 'remind' on the Inactive accounts list. Once again, the email for activation went out to the user (not good for an Admin Activate board). (I guess I better never use 'force activation' or the 'remind' options, or I will have members I don't necessarily want.) :mrgreen:

Lastly I activated the account in ACP - no emails to anyone, including the user. This is all very strange behavior for me. Not sure if it is a bug, but it sure is set up improperly for an 'Admin Activate' board.

ToonArmy
Registered User
Posts: 335
Joined: Fri Mar 26, 2004 7:31 pm
Location: Bristol, UK
Contact:

Re: Emails when Account is Activated

Post by ToonArmy »

lanesharon wrote:I just did the same thing. My board is setup for Admin activate. I did a 'force reactivation' on my test account. The email to activate was sent out to the user, not the Admin (kind of odd behavior for an Admin Activate board). Then, I used the 'remind' on the Inactive accounts list. Once again, the email for activation went out to the user (not good for an Admin Activate board). (I guess I better never use 'force activation' or the 'remind' options, or I will have members I don't necessarily want.) :mrgreen:

Lastly I activated the account in ACP - no emails to anyone, including the user. This is all very strange behavior for me. Not sure if it is a bug, but it sure is set up improperly for an 'Admin Activate' board.
I thought I should comment on this. "Force reactivation" activation is handled by the user regardless of the user activation setting in the ACP admin/user/none, if you wish to deactivate the account deactivate don't force the user to reactivate. ;)
Chris SmithBlogXMOOhlohArea51WikiNo support via PM/IM
Image

Locked