1
El_Jordo
How to customize "New user registration" e-mail
  • 2004/2/23 0:17

  • El_Jordo

  • Just popping in

  • Posts: 64

  • Since: 2003/4/23


As an admin, I get a "New user registration" e-mail every time a new user registers, which says, "User123 has just registered at [sitename]."

I'd like a little more information. For example:

Quote:
A new user has registered at [sitename]!

User: User123
E-mail: user123@email.net
IP: 123.45.67.8


An e-mail like that would be wonderful! But if IP isn't possible, I'd at least like the e-mail address they used to register.

Is there an easy way to add this functionality?

2
El_Jordo
Re: How to customize "New user registration" e-mail
  • 2004/2/24 15:53

  • El_Jordo

  • Just popping in

  • Posts: 64

  • Since: 2003/4/23


I found this block of code that seems to deal with new user registration notices. Can anybody give me a clue what to change?

Quote:
if ($xoopsConfigUser['new_user_notify'] == 1 && !empty($xoopsConfigUser['new_user_notify_group'])) {
$myts =& MyTextSanitizer::getInstance();
$xoopsMailer =& getMailer();
$xoopsMailer->useMail();
$member_handler =& xoops_gethandler('member');
$xoopsMailer->setToGroups($member_handler->getGroup($xoopsConfigUser['new_user_notify_group']));
$xoopsMailer->setFromEmail($xoopsConfig['adminmail']);
$xoopsMailer->setFromName($xoopsConfig['sitename']);
$xoopsMailer->setSubject(sprintf(_US_NEWUSERREGAT,$xoopsConfig['sitename']));
$xoopsMailer->setBody(sprintf(_US_HASJUSTREG,$myts->oopsStripSlashesGPC($uname)));
$xoopsMailer->send();
}

3
El_Jordo
Re: How to customize "New user registration" e-mail
  • 2004/2/25 19:36

  • El_Jordo

  • Just popping in

  • Posts: 64

  • Since: 2003/4/23


Anybody?

4
tl
Re: How to customize "New user registration" e-mail
  • 2004/2/25 20:47

  • tl

  • Friend of XOOPS

  • Posts: 999

  • Since: 2002/6/23


You would have to modify the template file

language/english/mail_template/adminactivate.tpl

Maybe add the followings (not tested though) to get what you want:
{IP}
{X_UEMAIL}


5
El_Jordo
Re: How to customize "New user registration" e-mail
  • 2004/2/26 1:31

  • El_Jordo

  • Just popping in

  • Posts: 64

  • Since: 2003/4/23


I don't think that's the right template to modify. My user registration doesn't require admin activation. And the e-mail that goes out to admins when admin activation is off doesn't seem to have a template. It all seems to come from the code I posted above.

Good suggestion, though. I wish it were that easy.

6
tl
Re: How to customize "New user registration" e-mail
  • 2004/2/26 2:50

  • tl

  • Friend of XOOPS

  • Posts: 999

  • Since: 2002/6/23


You could though follow the same philosophy and add a template, either a new one or a modified one, after the following line.

Quote:
if ($xoopsConfigUser['new_user_notify'] == 1 && !empty($xoopsConfigUser['new_user_notify_group'])) {



I think the codes are all there; you just need to tinker with it. Back up the original file if you are planning to.



7
El_Jordo
Re: How to customize "New user registration" e-mail
  • 2004/3/4 15:13

  • El_Jordo

  • Just popping in

  • Posts: 64

  • Since: 2003/4/23




I think I'm in over my head now... I'll just put up with the lack of information I guess.

But in future releases, this would be a great added feature.

8
kahumbu
Hack
  • 2004/4/17 16:37

  • kahumbu

  • Documentation Writer

  • Posts: 277

  • Since: 2003/8/23


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.

9
El_Jordo
Re: Hack
  • 2004/4/17 17:12

  • El_Jordo

  • Just popping in

  • Posts: 64

  • Since: 2003/4/23


Perfect! That's absolutely what I wanted, and it works perfectly.

Thanks so much!

10
Dave_L
Re: Hack
  • 2004/4/17 17:53

  • Dave_L

  • XOOPS is my life!

  • Posts: 2277

  • Since: 2003/11/7


Quote:
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.


I don't think it's necessary, since $HTTP_SERVER_VARS['REMOTE_ADDR'] probably won't contain any backslashes (\), but it shouldn't hurt anything.

That function simply calls the PHP function stripslashes.

But in new code, it's better to use $_SERVER['REMOTE_ADDR'].

Login

Who's Online

212 user(s) are online (131 user(s) are browsing Support Forums)


Members: 0


Guests: 212


more...

Donat-O-Meter

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

Latest GitHub Commits