1
JamesSAEP
IP Address in "new user" notification email
  • 2006/12/27 20:22

  • JamesSAEP

  • Just can't stay away

  • Posts: 732

  • Since: 2005/2/28


Does anyone know of a way to have a users IP address be added to the admin email notification that is sent out when a new user registers on a site?

Thanks.

2
JamesSAEP
Re: IP Address in "new user" notification email
  • 2006/12/27 22:26

  • JamesSAEP

  • Just can't stay away

  • Posts: 732

  • Since: 2005/2/28


Ok, in case anyone wants to do this, I followed the steps (found
HERE) below and the only thing I changed was the
$myts->oopsStripSlashesGPC($HTTP_SERVER_VARS['REMOTE_ADDR'] ));
had to be changed to $xoopsMailer->assign('USERIP', $myts->oopsStripSlashesGPC($ip=$_SERVER['REMOTE_ADDR'] ));
in order to work with php.ini "register globals off" setting.


Quote:

kahumbu wrote:
I had the same idea, so after not finding any solution, I decided to dig in the code.

This hack will let you receive username, email and IP of the new user (if you wanted to receive notifications on new registration).

First, make a new file regnotify.tpl in language/english/mail_template/ containing this text:
new user has registered:

Username: {USERNAME}
Email: {USEREMAIL}
User IP: {USERIP}


You could change that, of course, but keep those {variables}.

Second, open up register.php and add the hack around Line 266-267:
$xoopsMailer->useMail();
[
b]// Start of Hack[/b]
$xoopsMailer->setTemplate('regnotify.tpl');
$xoopsMailer->assign('USERNAME'$myts->oopsStripSlashesGPC($uname));
$xoopsMailer->assign('USEREMAIL'$myts->oopsStripSlashesGPC($email));
$xoopsMailer->assign('USERIP'$myts->oopsStripSlashesGPC($HTTP_SERVER_VARS['REMOTE_ADDR'] ));
[
b]// End of Hack[/b]
$member_handler =& xoops_gethandler('member');


Finally, comment out this line:
//$xoopsMailer->setBody(sprintf(_US_HASJUSTREG,$myts->oopsStripSlashesGPC($uname)));


I would like to get comments from the devs about using the $myts->... syntax with the REMOTE_ADDR var. I was just going along with the syntax of the other vars. I'm not exactly sure if I needed to do that.

For now, it works on my site. Hope this helps others. Feedback appreciated.

Login

Who's Online

386 user(s) are online (96 user(s) are browsing Support Forums)


Members: 0


Guests: 386


more...

Donat-O-Meter

Stats
Goal: $100.00
Due Date: Oct 31
Gross Amount: $0.00
Net Balance: $0.00
Left to go: $100.00
Make donations with PayPal!

Latest GitHub Commits