Notify Admin of New Users

This forum is now closed as part of retiring phpBB2
Forum rules
READ: phpBB.com Board-Wide Rules and Regulations

This forum is now closed due to phpBB2.0 being retired.
Post Reply
KHS
Registered User
Posts: 81
Joined: Fri Mar 14, 2003 8:19 pm

Notify Admin of New Users

Post by KHS » Sun Aug 03, 2003 12:23 pm

I upgraded to phpBB v2.0.5 and now find that one of my essential mods doesn't work. The mod enables the board to notify the administrator of the username/password whenever a new user registers on the board.

This is really essential for us and any help in getting the mod to work with v2.0.5 would really help.

The code I was using with 2.0.4 was as follows:
in includes/usercp_register.php find Code:

if ( $board_config['require_activation'] == USER_ACTIVATION_ADMIN )
{
$emailer->use_template("admin_activate", stripslashes($user_lang));
$emailer->email_address($board_config['board_email']);
$emailer->set_subject(); //$lang['New_account_subject']
$emailer->extra_headers($email_headers);

$emailer->assign_vars(array(
'USERNAME' => $username,
'EMAIL_SIG' => str_replace('<br />', "\n", "-- \n" . $board_config['board_email_sig']),

'U_ACTIVATE' => $server_url . '?mode=activate&act_key=' . $user_actkey)
);
$emailer->send();
$emailer->reset();
}



after, add
Code:

// MOD NOTIFY ADMIN OF NEW USER BEGIN
else
{
$emailer->use_template("admin_new_user", stripslashes($user_lang));
$emailer->email_address($board_config['board_email']);
$emailer->set_subject("A new user has registered at your forum");
$emailer->extra_headers($email_headers);

$emailer->assign_vars(array(
'SITENAME' => $board_config['sitename'],
'USERNAME' => $username,
'LOCATION' => $location
'EMAIL' => $email,
));
$emailer->send();
$emailer->reset();
}
// MOD NOTIFY ADMIN OF NEW USER END


The code is quite different in 2.0.5 and I'm a newbie at all this. Thanks guys and gals, the lack of this notification is really a problem to us. Thanks in anticipation.

O
Registered User
Posts: 60
Joined: Sat Jul 12, 2003 9:28 am

Post by O » Sun Aug 03, 2003 12:25 pm

you could always chose the account activation by user option.

User avatar
SupremeWeapon
Registered User
Posts: 593
Joined: Mon Feb 17, 2003 12:48 pm
Location: Battle Creek, Mi
Contact:

Post by SupremeWeapon » Sun Aug 03, 2003 12:34 pm

this your mod? who made the mod? i mean theres most likely a way but to release one for 2.0.5 need the authors approval :D

but looking at it and changing a few items i get
Could not find email template file :: admin_new_user

DEBUG MODE

Line : 116
File : c:\phpdev\www\styles_demo\phpbb2\includes\emailer.php


get rid of that problem and it should work...
Image

KHS
Registered User
Posts: 81
Joined: Fri Mar 14, 2003 8:19 pm

Post by KHS » Sun Aug 03, 2003 6:08 pm

I got the code from the board here. See: http://www.phpbb.com/phpBB/viewtopic.ph ... 665#373665

It worked fine in 2.0.4 but not in 2.0.5 but I don't know how to tell which part is causing the problem.

User avatar
warmweer
Registered User
Posts: 2378
Joined: Fri Jul 04, 2003 6:34 am
Location: Van Allen Belt ... well actually Belgium

Post by warmweer » Sun Aug 03, 2003 6:30 pm

KHS wrote: I got the code from the board here. See: http://www.phpbb.com/phpBB/viewtopic.ph ... 665#373665

It worked fine in 2.0.4 but not in 2.0.5 but I don't know how to tell which part is causing the problem.


Basically the reasoning behind the code is still ok however due to changes in emailer.php (for 2.0.5) the code for 2.0.4 can't work anymore. This is the code I use (and it works). All I'm doing is following the script for admin-activation.

No guarantees are given, use at your own risk (because I also adapted the template and added username and emailaddress. (but it should work with the normal template)

Code: Select all

			// AANPASSING BOARDMELDING NIEUWE REGISTRATIE START
         		else 
         		{
				$emailer->email_address($board_config['board_email']);
				$emailer->use_template("admin_activate", $board_config['default_lang']);
				$emailer->set_subject($lang['New_account_subject'] );

				$emailer->assign_vars(array(
					'USERNAME' => preg_replace($unhtml_specialchars_match, $unhtml_specialchars_replace, substr(str_replace("\'", "'", $username), 0, 25)),
					'EMAIL_ADDRESS' => $email,
					'EMAIL_SIG' => str_replace('<br />', "\n", "-- \n" . $board_config['board_email_sig']),

					'U_ACTIVATE' => $server_url . '?mode=activate&' . POST_USERS_URL . '=' . $user_id . '&act_key=' . $user_actkey)
				);
				$emailer->send();
				$emailer->reset();


     			} 
         			// AANPASSING BOARDMELDING NIEUWE REGISTRATIE EINDE
My board's not broken, it just went peculiar

KHS
Registered User
Posts: 81
Joined: Fri Mar 14, 2003 8:19 pm

Post by KHS » Mon Aug 04, 2003 8:26 am

Thanks Warmweer - you're a star. I was very quickly able to modify that to restore our old message, exactly the way I wanted it. Thanks so much.

jthomp
Registered User
Posts: 4
Joined: Sat Jan 08, 2005 5:27 pm
Location: Suwanee, GA
Contact:

Code For v2.0.11

Post by jthomp » Sun Jan 09, 2005 2:28 am

This code, based on the above code, works for v2.0.11.

Step 1: Add a new template file: language/lang_english/email/admin_new_user.tpl that contains the following:
Subject: New Account on {SITENAME}
Charset: iso-8859-1

A new account has been requested on {SITENAME}:
----------------------------
Username: {USERNAME}
Email: {EMAIL}
Location: {LOCATION}
Website: {WEB_SITE}
Interests: {INTERESTS}
----------------------------


Step 2: Add the following code to includes/usercp_register.php
Look for:

Code: Select all

 if ( $board_config['require_activation'] == USER_ACTIVATION_ADMIN )
{
     $sql = "SELECT user_email, user_lang
                FROM " . USERS_TABLE . "
                WHERE user_level = " . ADMIN;
     ...
 } 

then we add the following [after line 652 put the following]:

Code: Select all

     // MOD NOTIFY ADMIN OF NEW USER BEGIN
     else {
        $emailer->from($board_config['board_email']);
        $emailer->replyto($board_config['board_email']);
        $emailer->use_template("admin_new_user", stripslashes($user_lang));
        $emailer->email_address($board_config['board_email']);
        $emailer->set_subject("A new user has registered at your forum", $board_config['sitename']);
        $emailer->assign_vars(array(
           'SITENAME' => $board_config['sitename'],
           'USERNAME' => preg_replace($unhtml_specialchars_match, 
$unhtml_specialchars_replace, substr(str_replace("\'", "'", $username), 0, 25)),
           'LOCATION' => $location,
           'WEB_SITE' => $website,
           'INTERESTS' => $interests,
           'EMAIL' => $email,
        ));
       $emailer->send();
       $emailer->reset();
}
// MOD NOTIFY ADMIN OF NEW USER END

tinman
Registered User
Posts: 57
Joined: Mon Aug 04, 2003 9:33 pm
Contact:

Post by tinman » Fri Jan 14, 2005 5:37 pm

tried this but nothing seems to get mailed to me other than the normal notifications.......

jwig
Registered User
Posts: 56
Joined: Mon Dec 05, 2005 4:51 pm
Contact:

Post by jwig » Sat Jul 15, 2006 7:14 pm

Hi. It's been awhile since anyone posted to this, but just in case others are looking: I just installed the above code and it works for v2.0.21. Thanks to the original posters!

Take Care,

JJ
Precious and Pleasant Boutique
http://www.PreciousAndPleasant.com
"An Elegant Boutique for Children and Their Mothers"
Free Shipping Code: 412103097

Post Reply

Return to “[2.0.x] MOD Requests”