Go Back   vb.org Archive > vBulletin 3 Discussion > vB3 General Discussions
FAQ Community Calendar Today's Posts Search

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #2  
Old 04-21-2004, 04:47 PM
mr_fox mr_fox is offline
 
Join Date: Sep 2002
Posts: 4
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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=""

?>
Reply With Quote
 


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 02:27 PM.


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.04528 seconds
  • Memory Usage 2,526KB
  • Queries Executed 12 (?)
More Information
Template Usage:
  • (1)SHOWTHREAD
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)ad_showthread_beforeqr
  • (1)bbcode_php
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)navbar
  • (3)navbar_link
  • (120)option
  • (5)post_thanks_box
  • (5)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (5)post_thanks_postbit_info
  • (5)postbit
  • (5)postbit_onlinestatus
  • (5)postbit_wrapper
  • (1)showthread_list
  • (1)spacer_close
  • (1)spacer_open
  • (1)tagbit_wrapper 

Phrase Groups Available:
  • global
  • inlinemod
  • postbit
  • posting
  • reputationlevel
  • showthread
Included Files:
  • ./showthread.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/functions_bigthree.php
  • ./includes/class_postbit.php
  • ./includes/class_bbcode.php
  • ./includes/functions_reputation.php
  • ./includes/functions_threadedmode.php
  • ./includes/functions_post_thanks.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_postinfo_query
  • fetch_postinfo
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • showthread_start
  • showthread_getinfo
  • forumjump
  • showthread_post_start
  • showthread_query_postids_threaded
  • showthread_threaded_construct_link
  • showthread_query
  • bbcode_fetch_tags
  • bbcode_create
  • showthread_postbit_create
  • postbit_factory
  • postbit_display_start
  • post_thanks_function_post_thanks_off_start
  • post_thanks_function_post_thanks_off_end
  • post_thanks_function_fetch_thanks_start
  • post_thanks_function_fetch_thanks_end
  • post_thanks_function_thanked_already_start
  • post_thanks_function_thanked_already_end
  • fetch_musername
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete