vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB3 General Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=111)
-   -   PM on register (https://vborg.vbsupport.ru/showthread.php?t=64190)

djohn 04-21-2004 11:12 AM

PM on register
 
Is there such hack, that sends user a welcome PM when he registers?

mr_fox 04-21-2004 04:47 PM

PHP Code:

<?php 
/ *=================================================
====================* 
||  
##################################################
################# || 
|| # Welcome PM Hack by rob_daemon                                   # || 
|| #     LAST UPDATED: Tue Apr 13 2004 19:34 PST                         # || 
|| # --------------------------------------------------------------- # || 
|| # VARIOUS MODIDIFICATIONS: 
|| #     Boofo - Addslashes to username 
|| #     Cloudrunner - Table prefix in SQL queries 
||  ##################################################
################# || 
*================================================
=====================*/ 

INSTRUCTIONS

------------ 
Open phpMyAdmin and run the following queries

//  ##################################################
############################################ 

INSERT INTO `setting` (`varname`, `grouptitle`, `value`, `defaultvalue`, `optioncode`, `displayorder`, `advanced`, `volatile`) VALUES ('regpmfrom''register''1''1'''14000); 
INSERT INTO phrase (phraseidlanguageidvarname, `text`, phrasetypeidVALUES (NULL'0''setting_regpmfrom_title''User Who Sends Automatic PM Upon Registration''5000'); 
INSERT INTO phrase (phraseidlanguageidvarname, `text`, phrasetypeidVALUES (NULL'0',  'setting_regpmfrom_desc''Enter the user ID of the person whose account you'd like to be used when sending new users a welcome PM upon registering.', '5000'); 


INSERT INTO `setting` (`varname`, `grouptitle`, `value`, `defaultvalue`, `optioncode`, `displayorder`, `advanced`, `volatile`) VALUES ('
regpmtext', 'register', 'Hi $username and welcome to $bbtitle!rnrnWe appreciate you taking the time to register on our site and we hope you enjoy your stay.rnrnIf you have any questionsyou can ask an administrator for assistance.rnrnWe hope to see you around.rnrnSincerely,rnThe $bbtitle staff', 'Hi $username and welcome to $bbtitle!rnrnWe appreciate you taking the time to register on our site and we hope you enjoy your stay.rnrnIf you have any questionsyou can ask an administrator for assistance.rnrnWe hope to see you around.rnrnSincerely,rnThe $bbtitle staff', 'textarea', 150, 0, 1); 
INSERT INTO phrase (phraseid, languageid, varname, `text`, phrasetypeid) VALUES (NULL, '
0', 'setting_regpmtext_title', 'Welcome PM Text', '5000'); 
INSERT INTO phrase (phraseid, languageid, varname, `text`, phrasetypeid) VALUES (NULL, '
0',  'setting_regpmtext_desc', 'Set the text of the PM sent to all new users.<br />r<br />rNoteYou can use the following variables to specify the <b>user's</b> information: $username, $userid, $email. And you can use the $bbtitle to specify the board's name.', '5000'); 


INSERT INTO `setting` (`varname`, `grouptitle`, `value`, `defaultvalue`, `optioncode`, `displayorder`, `advanced`, `volatile`) VALUES ('
regpmtitle', 'register', 'Welcome to $bbtitle!', 'Welcome to $bbtitle!', '', 160, 0, 0); 
INSERT INTO phrase (phraseid, languageid, varname, `text`, phrasetypeid) VALUES (NULL, '
0', 'setting_regpmtitle_title', 'Title Of the PM That is Automatically Sent to New Users', '5000'); 
INSERT INTO phrase (phraseid, languageid, varname, `text`, phrasetypeid) VALUES (NULL, '
0',  'setting_regpmtitle_desc', 'Set the title of the PM that is sent to all new users automaticallyYou can use the same variables as the ones that you can use for the PM text (see above).', '5000'); 

//  ##################################################
############################################ 

------------ Next, you MUST go: Admin CP --> Options --> vBulletin Options --> User Registration Options --> Save 
    -------- If you don'
do thisyou will get SQL errors when a user registers


------------ 
Nextopen ./register.php and look for: 

//  ##################################################
############################################ 
        
if ($vboptions['newuseremail'] != ''
        { 
            if (
$havefields
            { 
                 
$DB_site->data_seek(0$profilefields); 
                 while (
$profilefield $DB_site->fetch_array($profilefields)) 
                 { 
                    
$varname "field$profilefield[profilefieldid]"
                    
$cfield = $$varname
                    
$customfields .= "$profilefield[title] : $cfield\n"
                 } 
            } 

            
$username $_POST['username']; 
            
$email $_POST['email']; 
            eval(
fetch_email_phrases('newuser'0)); 

            
vbmail($vboptions['newuseremail'], $subject$message); 
        } 
//  ##################################################
############################################ 

------------ AFTER ADD

//  ##################################################
############################################ 

        //  ##################################################
################# 
        // # WELCOME PM HACK BY rob_daemon 
        //  ##################################################
################# 
         
        
$username $_POST['username']; 
         
        
// Process each one of the replacement vars 
        
$vars = array( 
            
'$bbtitle' => $vboptions['bbtitle'], 
            
'$username' => $username
            
'$email' => $email
            
'$userid' => $userid 
        
); 
         
        
$pmoptions['regpmtext'] = $vboptions['regpmtext']; 
        
$pmoptions['regpmtitle'] = $vboptions['regpmtitle']; 
        
$pmoptions['regpmfrom'] = $vboptions['regpmfrom']; 
         
        
// Now that we have the options, we need to process eaach of the 
        // vars we can use 
        
foreach($vars AS $_key => $_value
        { 
            
$pmoptions['regpmtext'] = str_replace($_key$_value$pmoptions['regpmtext']); 
            
$pmoptions['regpmtitle'] = str_replace($_key$_value$pmoptions['regpmtitle']); 
        } 

        
$get_pm_from $DB_site->query_first("SELECT username,userid FROM " TABLE_PREFIX "user WHERE userid=$pmoptions[regpmfrom]"); 
         
        
// Send the new owner a PM 
        
$DB_site->query
            
"INSERT INTO " TABLE_PREFIX "pmtext 
            ( 
                fromuserid, 
                fromusername, 
                title, 
                message, 
                touserarray, 
                iconid, 
                dateline, 
                showsignature, 
                allowsmilie 
            ) 
            VALUES 
            ( 
                
$get_pm_from[userid]
                '
$get_pm_from[username]', 
                '
$pmoptions[regpmtitle]', 
                '" 
addslashes($pmoptions['regpmtext']) . "', 
                '" 
addslashes(serialize(array($userid => $username))) . "', 
                0, 
                " 
TIMENOW ", 
                1, 
                1 
            )" 
        
); 
         
        
$pmtextid $DB_site->insert_id(); 
         
        
$DB_site->query("UPDATE " TABLE_PREFIX "user SET pmtotal=pmtotal+1, pmunread=pmunread+1, pmpopup=2 WHERE userid=$userid"); 
        
$DB_site->query
        
"INSERT INTO " TABLE_PREFIX "pm 
            ( 
                pmtextid, 
                userid, 
                folderid, 
                messageread 
            ) 
            VALUES 
            ( 
                '
$pmtextid', 
                '
$userid', 
                '0', 
                '0' 
            )" 
        
); 
        
//  ##################################################
################# 
        // # END WELCOME PM HACK 
        //  ##################################################
################# 

//  ##################################################
############################################ 



You are done <img src="images/smilies/smile.gif" border="0" alt=""

?>


13th_Disciple 04-21-2004 05:26 PM

thread for that hack is here..

https://vborg.vbsupport.ru/showthread.php?t=63269

criscokid 06-09-2006 05:50 PM

Is there anything available for vb3.5.x?

Reeve of shinra 06-09-2006 11:05 PM

Yes, but you will have to search for it. Its native to vb 3.6 however.


All times are GMT. The time now is 03:03 AM.

Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.

X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.01164 seconds
  • Memory Usage 1,792KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)bbcode_php_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (5)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • printthread_start
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete