View Full Version : How to automatically send a new user a welcome message
pachoofoosh
08-07-2013, 11:22 AM
This code will automatically send new users a welcome message when they register. :happycbig:
Step 1.) Open up register.php. Find the line that looks like the following:
$document->addLangvar($mysidia->lang->success.$mysidia->input->post("username").$mysidia->lang->success2);
Step 2.) Right under that line, paste this:
$pm = new PrivateMessage(); // Send them a welcoming message
$pm->setsender('YourUsernameHere');
$pm->setrecipient(htmlentities(addslashes(trim($mysidia->input->post("username")))));
$pm->setmessage("the message title", "put your welcoming message here");
$pm->post();
Hall of Famer
08-07-2013, 01:46 PM
Looks good. Note there is no need to automatically load a class file, as the autoloader will attempt to find the appropriate class file for you.
pachoofoosh
08-09-2013, 10:20 AM
Looks good. Note there is no need to automatically load a class file, as the autoloader will attempt to find the appropriate class file for you.
Thanks! I've updated the code now. :happycbig:
Hall of Famer
08-10-2013, 10:33 AM
Great, this looks like it will help users a lot.
AndromedaKerova
04-19-2015, 09:58 PM
I assume this is incompatible with 1.3.4 because I can't see a $document thing in the register.php
Kyttias
04-20-2015, 12:54 AM
I'm not in the best position to test this, but for v1.3.4, open up view/registerview.php, and find:
if($mysidia->input->post("submit")){
$document->setTitle($this->lang->success_title);
$document->addLangvar($this->lang->success.$mysidia->input->post("username").$this->lang->success2);
return;
}
and replace it with:
if($mysidia->input->post("submit")){
$document->setTitle($this->lang->success_title);
$document->addLangvar($this->lang->success.$mysidia->input->post("username").$this->lang->success2);
$pm = new PrivateMessage(); // Send them a welcoming message
$pm->setsender('YourUsernameHere');
$pm->setrecipient(htmlentities(addslashes(trim($mysidia->input->post("username")))));
$pm->setmessage("the message title", "put your welcoming message here");
$pm->post();
return;
}
Could someone test this?
AndromedaKerova
04-20-2015, 01:11 AM
Tested and verified. Good work! Thank you Kyttias!
Kyttias
04-20-2015, 01:15 AM
Oh cool! :BIGO: I was wondering how to send PMs to people with the system.
LUC1G07CH1
07-16-2017, 12:18 PM
This is pretty old, but i have to say that it works 100% fine here.
Kyttias is just like...my heroine. Now i doesn't need to put the welcome code to random pages.
vBulletin® v3.8.11, Copyright ©2000-2025, vBulletin Solutions Inc.