UseBB Community

The official board for UseBB help and discussion

UseBB Community » Resources & Customization » Admin account activation - email notification

Admin account activation - email notification

Moderators: Gaia.

Page: 1

Author Post
Member
Registered: Mar 2007
Posts: 10
I'm working on a forum for a client which will use admin activation of new members. UseBB 1.0.5 supports this nicely, but when a new user registers there is no email notification sent to the admin. Perhaps there's an option I missed?

Meanwhile I made a small change that bcc's the "Account awaiting activation" email to the admin.

Around line 1142 of accounts/functions.php I found:

if ( !empty($bcc_email) )
$headers[] = 'Bcc: '.$bcc_email;
$headers[] = 'Date: '.date('r');
$headers[] = 'Message-Id: '.sprintf("<%s.%s>", substr(md5(time()), 4, 10), $from_email);
$headers[] = 'X-Mailer: UseBB';


And changed it to:

if (stristr($subject,"Account awaiting activation"))
$bcc_email = $this->get_config('admin_email');
if ( !empty($bcc_email) )
$headers[] = 'Bcc: '.$bcc_email;
$headers[] = 'Date: '.date('r');
$headers[] = 'Message-Id: '.sprintf("<%s.%s>", substr(md5(time()), 4, 10), $from_email);
$headers[] = 'X-Mailer: UseBB';


Just the first two lines are added. If there's a built-in way of getting admin notification of new registration I'd appreciated hearing. I'd prefer not to alter the source if possible.

Thanks!
Developer
Registered: Apr 2004
Posts: 2202
Location: Belgium
You should add the BCC parameter in the usebb_mail() call in the register page, now you have this implemented in a very dirty way and it will only work when the language is set to English.
_______________
--Dietrich (developer)
UseBB roadmap, dev mailing list & weblog
Member
Registered: Mar 2007
Posts: 10
Well I started to do it there, then I saw that in functions.php the usebb_mail() function sets $bcc_email=''. I didn't understand why that was, so I decided to leave it alone.
Member
Registered: Mar 2007
Posts: 27
Is it possible to get a mail as admin for new member-registrations?
(not for activation, only as information)
Developer
Registered: Apr 2004
Posts: 2202
Location: Belgium
sleddog wrote
Well I started to do it there, then I saw that in functions.php the usebb_mail() function sets $bcc_email=''. I didn't understand why that was, so I decided to leave it alone.


$bcc_email=''

is a way to make function parameters optional in PHP.

The correct solution is to change line 235-238 of sources/panel_register.php to:
$functions->usebb_mail($lang['AdminActivationEmailSubject'], 
$lang['AdminActivationEmailBody'], array(
'account_name' => stripslashes($_POST['user']),
'password' => $_POST['passwd1']
), $functions->get_config('board_name'),
$functions->get_config('admin_email'), $_POST['email'],
$functions->get_config('admin_email'));
_______________
--Dietrich (developer)
UseBB roadmap, dev mailing list & weblog
« Last edit by Dietrich on Tue Mar 20, 2007 6:51 pm. »
Developer
Registered: Apr 2004
Posts: 2202
Location: Belgium
Christiane wrote
Is it possible to get a mail as admin for new member-registrations?
(not for activation, only as information)


This is not possible out of the box, just change line 242-245 to:

$functions->usebb_mail($lang['RegistrationEmailSubject'], 
$lang['RegistrationEmailBody'], array(
'account_name' => stripslashes($_POST['user']),
'password' => $_POST['passwd1']
), $functions->get_config('board_name'),
$functions->get_config('admin_email'), $_POST['email'],
$functions->get_config('admin_email'));


Note, these code changes remain unsupported and you will have to reapply them when updating!
_______________
--Dietrich (developer)
UseBB roadmap, dev mailing list & weblog
Developer
Registered: Apr 2004
Posts: 2202
Location: Belgium
I merged two topics about nearly the same code change, and moved this to Resources since the solution in the original post was far from ideal.
_______________
--Dietrich (developer)
UseBB roadmap, dev mailing list & weblog
Member
Registered: Mar 2007
Posts: 10
Dietrich wrote
$bcc_email=''

is a way to make function parameters optional in PHP.


I didn't know that, now I understand. Thanks for taking the time for this -- it's appreciated.
Member
Registered: Mar 2007
Posts: 27
For my understanding: In which way do the codes in #5 und #6 differ and whats the code i've to use?
Member
Registered: Mar 2007
Posts: 10
The first (post #5) is for when the board is set for administrator approval of new registrations.

The second is for when admin approval is not required. That's what you want I think.

Note the difference in the first line of each code bit.
Member
Registered: Mar 2007
Posts: 10
Dietrich wrote
I merged two topics about nearly the same code change, and moved this to Resources since the solution in the original post was far from ideal.


OK, OK, I get the point! :)
Member
Registered: Mar 2007
Posts: 27
I've tried #6 but its not running. Or have i also to change according ro #5?
Developer
Registered: Apr 2004
Posts: 2202
Location: Belgium
You will need to add $functions->get_config('admin_email') to the other usebb_mail() call as well, depending on what your configuration is set to and thus which code block is executed.
_______________
--Dietrich (developer)
UseBB roadmap, dev mailing list & weblog
Member
Registered: Jun 2007
Posts: 122
Location: Gatineau, QC, Canada
Applied the code in post #5 (Admin approval) and works great!

I wonder if I can also apply what's in #6 if ever I change to Email activation without interfering with the #5 code?

Gene
Developer
Registered: Apr 2004
Posts: 2202
Location: Belgium
There shouldn't be a problem applying these changes, however I do not guarantee they also work with later versions. All these mods remain unsupported.
_______________
--Dietrich (developer)
UseBB roadmap, dev mailing list & weblog
Member
Registered: Jun 2007
Posts: 122
Location: Gatineau, QC, Canada
Dietrich wrote
There shouldn't be a problem applying these changes, however I do not guarantee they also work with later versions. All these mods remain unsupported.


#5 works great on ver. 1.6...

Gene

Page: 1

UseBB Community » Resources & Customization » Admin account activation - email notification

UseBB Community is powered by UseBB 1 Forum Software