How to automatically send a new user a welcome message

Forum
Last Post
Threads / Messages

pachoofoosh

Artist
Member
Joined
Dec 10, 2012
Messages
99
Points
6
Location
New York
Mysidian Dollar
10,255
(1.3.3) Automatically send new users welcome messages

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:
PHP:
$document->addLangvar($mysidia->lang->success.$mysidia->input->post("username").$mysidia->lang->success2);

Step 2.) Right under that line, paste this:
PHP:
$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();
 
Last edited:
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.
 
I assume this is incompatible with 1.3.4 because I can't see a $document thing in the register.php
 
I'm not in the best position to test this, but for v1.3.4, open up view/registerview.php, and find:

PHP:
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:

PHP:
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?
 
Oh cool! :BIGO: I was wondering how to send PMs to people with the system.
 
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.
 

Similar threads

Users who are viewing this thread

  • Forum Contains New Posts
  • Forum Contains No New Posts

Forum statistics

Threads
4,277
Messages
33,118
Members
1,602
Latest member
BerrieMilk
BETA

Latest Threads

Top