Mysidia Adoptables Support Forum

Mysidia Adoptables Support Forum (http://www.mysidiaadoptables.com/forum/index.php)
-   Tutorials and Tips (http://www.mysidiaadoptables.com/forum/forumdisplay.php?f=27)
-   -   How to automatically send a new user a welcome message (http://www.mysidiaadoptables.com/forum/showthread.php?t=4231)

pachoofoosh 08-07-2013 11:22 AM

(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 Code:

$document->addLangvar($mysidia->lang->success.$mysidia->input->post("username").$mysidia->lang->success2); 

Step 2.) Right under that line, paste this:
PHP Code:

$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

Quote:

Originally Posted by Hall of Famer (Post 27728)
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:

PHP Code:

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

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.


All times are GMT -5. The time now is 06:51 PM.

Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.