PostNuke

Flexible Content Management System

News

New Mail on User Registration Hack for Core file: NS-NewUser/User.php

Contributed by Sounds good however on Apr 08, 2002 - 04:00 AM

It's actually a fairly non-invasive technique.




First off open up the following File:




$PostNukeRoot\modules\NS-NewUser\user.php




Then go ALL the way to the bottom of the file. At around line 270 you will find the following code:




if($dbconn->ErrorNo()<>0) {


echo $dbconn->ErrorNo(). "Create default group membership: ".$dbconn->ErrorMsg(). "
";


error_log ($dbconn->ErrorNo(). "Create default group membership: ".$dbconn->ErrorMsg(). "
");


}


}




Directly under that snippet, insert the following:




// NewUser Mail To Admin Hack


// Author: Cloudrunner of The Noble Pagan


// Website: www.noblepagan.com


$message1 = "A New User Has Registered At $sitename!\n\n They used this email: ($var[email]) to register the following NickName: $var[uname]";


$subject1 = "A New User Has Registered At $sitename!";


$to = "$adminmail";


// End Part 1 of NewUser Mail To Admin Hack




After you do this, jump down to some where around line 278 or so and you will find this snippet:




if ($system == 1) {




Directly below that insert the following:




//Part 2 of NewUser hack


pnMail($to, $subject1, $message1, "From: $from\nX-Mailer: PHP/" . phpversion());


// End Part 2




and Lastly find this code around line 281:




} else {


pnMail($var['email'], $subject, $message, "From: $from\nX-Mailer: PHP/" . phpversion());




and insert this line directly below that:




// Part 3 of NewUser Hack


pnMail($to, $subject1, $message1, "From: $from\nX-Mailer: PHP/" . phpversion());


// End Part 3




Save the file, and then upload to overwrite the file on your server.




Now whenever a new user registers, you will get a short notification email telling you someone has.




You can modify the message sent by modifying the variable: $message1 leave the following within the message quotes however: $sitename, $var[email], and $var[uname].




That's it. I hope that this helps some of you out. Feel free to email me with any questions (even though there shouldn't bee, it's fairly straightforward) at: noblepagan@noblepagan.com




May your dreams come to life.




)O( Cloudrunner )O(


The Noble Pagan


http://www.noblepagan.com
3122