Previous Thread
Next Thread
Print Thread
Rate Thread
Joined: Apr 2001
Posts: 3,266
Member
Member
Offline
Joined: Apr 2001
Posts: 3,266
Mod Name / Version: Staff Notification of New Registration

Description: Okay Threads only alerts you of new registrations if you click approve all registrations. Now I know I dont want this. However I might want to know when someone new registers without having to go approve them so they can use the board.

This is a quick and dirty hack:

Open adduser.php

Code
<br />Find:<br /><br />// -------------------------------------<br />// Now we need to mail them the password<br />   if ( ($Loginname) && ($Email) ) {<br />      $to      = $Email;<br />      $subject = "{$ubbt_lang['PASS_SUB']}";<br />      eval ("\$msg = \"{$ubbt_lang['PASS_BODY']}\";");<br />      if ($config['verify']) {<br />         $msg .= " " . $ubbt_lang['DOVERIFY'] ." {$config['phpurl']}/verifyemail.php?verify=$Uid-$key&Cat=$Cat";<br />      }<br />      elseif ($config['userreg']) {<br />         $msg .= " " . $ubbt_lang['NEEDAPPROVAL'];<br />      }<br />      $mailer -> send_mail("","","$to","$subject","$msg");<br /><br />  }<br /><br />Place after it this:<br /><br />// ---------------------------------------------------------------------<br />// Now if we want to notify staff of new user registrations we need to send an<br />// email to all the staff<br />   if ( ($Loginname) && ($Email) ) {<br />      $query = "<br />         SELECT U_Email<br />         FROM   {$config['tbprefix']}Users<br />         WHERE  U_Status = 'Administrator'<br />      ";<br />      $sth = $dbh -> do_query($query);<br />      while(list($adminemail) = $dbh -> fetch_array($sth)) {<br />         if (!$adminemail) {<br />            continue;<br />         }<br />         $newuser = rawurlencode($Loginname);<br />         $to      = $adminemail;<br />         $subject = "{$ubbt_lang['NEWREG']} {$config['title']}";<br />         $msg     = "{$ubbt_lang['NEWREG']} {$config['title']}\n\n Username: $Loginname\n\n Email: $Email\n\n IP: $ip\n\n{$config['phpurl']}/ubbthreads.php";<br />         $mailer -> send_mail("","","$to","$subject","$msg");<br />      }<br />   }<br /><br />   if ( ($Loginname) && ($Email) ) {<br />      $query = "<br />         SELECT U_Email<br />         FROM   {$config['tbprefix']}Users<br />         WHERE  U_Status = 'Moderator'<br />      ";<br />      $sth = $dbh -> do_query($query);<br />      while(list($modemail) = $dbh -> fetch_array($sth)) {<br />         if (!$modemail) {<br />            continue;<br />         }<br />         $newuser = rawurlencode($Loginname);<br />         $to      = $modemail;<br />         $subject = "{$ubbt_lang['NEWREG']} {$config['title']}";<br />         $msg     = "{$ubbt_lang['NEWREG']} {$config['title']}\n\n Username: $Loginname\n\n Email: $Email\n\n IP: $ip\n\n{$config['phpurl']}/ubbthreads.php";<br />         $mailer -> send_mail("","","$to","$subject","$msg");<br />      }<br />   }<br />



Now you can remove the part that mods get sent registration emails by not copying that part.









Working Under: UBB.Threads 6.4

Mod Status: Beta

Any pre-requisites: N/A

Author(s): Omegatron

Date: 12/21/03

Credits:

Files Altered: adduser.php

New Files: None

Database Altered: No

Info/Instructions:

Disclaimer: Please backup every file that you intend to modify.
If the modification modifies the database, it's a good idea to backup your database before doing so.

Note: If you modify your UBB.Threads code, you may be giving up your right for "official" support from Infopop.If you need official support, you'll need to restore unmodified files.

Sponsored Links
Joined: Mar 2001
Posts: 644
Member
Member
Offline
Joined: Mar 2001
Posts: 644
Handy, thanks.

Joined: Sep 2003
Posts: 803
Coder
Coder
Offline
Joined: Sep 2003
Posts: 803
Promptly added. thanks.

It was easy for even me

Joined: Apr 2001
Posts: 3,266
Member
Member
Offline
Joined: Apr 2001
Posts: 3,266
Like I said very quick mod.

Joined: Dec 2003
Posts: 2
Lurker
Lurker
Offline
Joined: Dec 2003
Posts: 2
Omegatron,

Thanks very much for the mod. I find it quite useful. A couple of questions though. I don't understand the last line in the instructions that reads:

"Now you can remove the part that mods get sent registration emails by not copying that part."

You lost me here. Are you saying to remove the following section of unmodified code?

[ code snippet removed post-facto so as not to confuse people. ]


Also, some admins including myself might find it useful to be notified only after new users verify their accounts. Do you think this mod could be made to work this way by putting it inside verifyemail.php?

Aloha,

-K

Last edited by Kahuna; 01/13/2004 11:01 PM.
Sponsored Links
Joined: Apr 2001
Posts: 3,266
Member
Member
Offline
Joined: Apr 2001
Posts: 3,266
What I mean is this

If you do not want moderators to get an email you omit this part the second half

if ( ($Loginname) && ($Email) ) {
$query = "
SELECT U_Email
FROM {$config['tbprefix']}Users
WHERE U_Status = 'Moderator'
";
$sth = $dbh -> do_query($query);
while(list($modemail) = $dbh -> fetch_array($sth)) {
if (!$modemail) {
continue;
}
$newuser = rawurlencode($Loginname);
$to = $modemail;
$subject = "{$ubbt_lang['NEWREG']} {$config['title']}";
$msg = "{$ubbt_lang['NEWREG']} {$config['title']}\n\n Username: $Loginname\n\n Email: $Email\n\n IP: $ip\n\n{$config['phpurl']}/ubbthreads.php";
$mailer -> send_mail("","","$to","$subject","$msg");
}
}

Yes you should be able to play with this and try copying it under the mailer in verifyemail.php It would work there as well or should.

Joined: Dec 2003
Posts: 2
Lurker
Lurker
Offline
Joined: Dec 2003
Posts: 2
Suddenly the lightbulb goes on. Thank you!

Joined: Jun 2004
Posts: 10
Newbie
Newbie
Joined: Jun 2004
Posts: 10
Sorry this post should be Re: Omegatron
Thank you this is a nice quick hack. Quick question, I have two other administrators and one is complaining about receiving an email every time someone registers. Is there a way to exclude one admin from the mailing? Thank You.

Last edited by Menemeth; 07/25/2004 6:12 PM.
Joined: Sep 2003
Posts: 488
Code Monkey
Code Monkey
Joined: Sep 2003
Posts: 488
I think this should work....

CHANGE THIS PART:

Code
SELECT U_Email <br />FROM   {$config['tbprefix']}Users <br />WHERE  U_Status = 'Administrator'  


TO THIS:

Code
SELECT U_Email <br />FROM   {$config['tbprefix']}Users <br />WHERE  U_Status = 'Administrator' <br />AND U_Username <> 'usernameofadmin'  


"usernameofadmin" is the one who is excluded from the mailings 8)

Joined: Jul 2003
Posts: 46
Junior Member
Junior Member
Offline
Joined: Jul 2003
Posts: 46
Let's up the anty! I have 9 Administrators, but ONLY want 2 of them to receive the mail notification. Is this possible to do?

Sponsored Links
Joined: Apr 2001
Posts: 3,266
Member
Member
Offline
Joined: Apr 2001
Posts: 3,266
Actually change the query to this

SELECT U_Email

FROM {$config['tbprefix']}Users

WHERE U_Status = 'Administrator'

AND U_Username = 'firstadminname'

OR U_Username = 'secondadminname'

Joined: Jul 2003
Posts: 46
Junior Member
Junior Member
Offline
Joined: Jul 2003
Posts: 46
It Works! Thank You!

Joined: Sep 2006
Posts: 75
Power User
Power User
Offline
Joined: Sep 2006
Posts: 75
Is there any chance of having this work in 6.5? There is no adduser.php. Any hints?

Joined: Nov 2004
Posts: 25
Newbie
Newbie
Offline
Joined: Nov 2004
Posts: 25
works fine with 6.5 and 6.5 does have adduser.php

Joined: Sep 2006
Posts: 75
Power User
Power User
Offline
Joined: Sep 2006
Posts: 75
The only adduser.php there is, is a language dictionary file. It doesn't have the relevant code in it.

Joined: Oct 2003
Posts: 2,305
Old Hand
Old Hand
Joined: Oct 2003
Posts: 2,305
must be an adduser.php in the main ubbthreads directory or ya won;t be getting new users


Link Copied to Clipboard
Donate Today!
Donate via PayPal

Donate to UBBDev today to help aid in Operational, Server and Script Maintenance, and Development costs.

Please also see our parent organization VNC Web Services if you're in the need of a new UBB.threads Install or Upgrade, Site/Server Migrations, or Security and Coding Services.
Recommended Hosts
We have personally worked with and recommend the following Web Hosts:
Stable Host
bluehost
InterServer
Visit us on Facebook
Member Spotlight
Gizmo
Gizmo
Portland, OR, USA
Posts: 5,833
Joined: January 2000
Forum Statistics
Forums63
Topics37,573
Posts293,925
Members13,849
Most Online5,166
Sep 15th, 2019
Today's Statistics
Currently Online
Topics Created
Posts Made
Users Online
Birthdays
Top Posters
AllenAyres 21,079
JoshPet 10,369
LK 7,394
Lord Dexter 6,708
Gizmo 5,833
Greg Hard 4,625
Top Posters(30 Days)
Top Likes Received
isaac 82
Gizmo 20
Brett 7
WebGuy 2
Morgan 2
Top Likes Received (30 Days)
None yet
The UBB.Developers Network (UBB.Dev/Threads.Dev) is ©2000-2024 VNC Web Services

 
Powered by UBB.threads™ PHP Forum Software 8.0.0
(Preview build 20221218)