View Single Post
  #6  
Old 06-23-2005, 03:01 PM
fly fly is offline
 
Join Date: Oct 2003
Posts: 1,215
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Okay, I think I've figured part of it out. It doesn't seem that the code is grabbing the actual $bbuserinfo['userid']. Sometimes its null.

Any chance you could take a look at all the code for me? As it actually does a couple of things. Thanks.

(Sorry its kind of a mess, I cant really write my own code, so I've pieced together other peoples code to make this.)

This is my register.php (with an extra line of actual vB code on either end, so that you know where I stuck it)
PHP Code:
// delete activationid
        //$DB_site->query("DELETE FROM " . TABLE_PREFIX . "useractivation WHERE userid=$userinfo[userid] AND type=0");

        // ###################################################################
        // # WELCOME HACK 
        // ###################################################################

        
$username $bbuserinfo['username'];
        
//$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['regforum'] = $vboptions['regforum'];
        
        
// 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']);
        }
        
        
// ########## START THREAD CREATION ##########
        
$forumid $pmoptions['regforum'];
        
$foruminfo fetch_foruminfo($forumid);
        
$post[title] = $pmoptions['regpmtitle'];
        
$post[message] = $pmoptions['regpmtext'];
        
$post[poststarttime] = TIMENOW;
        
$post[posthash] = md5($post[poststarttime] . $bbuserinfo['userid'] . $bbuserinfo['salt']);
        
$post['emailupdate'] = 9999;
        
build_new_post('thread'$foruminfo, array(), 0$post$errors);
        
// ########## END THREAD CREATION ##########

        // ########## START SEND PM TO USER ##########
        
$from_userid 3;
        
$from_username theacoustician;
        
$welcome_thread $post['threadid']; //thread id of thread created above

        
$to_userid $bbuserinfo['userid'];
        
$to_username $bbuserinfo['username'];

        
$title "Important information regarding your registration!";
        
$message "Pending your full approval, we have created a thread for you.  The thread is located [url=http://uselessforums.com/showthread.php?t=" $welcome_thread "]here[/url].  This will be the only thread you can post in until an administrator approves your membership.  If you have any questions that you'd rather not post, feel free to reply to this private message.";
        
$iconid 0;
        
$signature=1// 1 to show sig, 0 to hide it
        
$disablesmilies=1// 1 to hide smilies, 0 to show them

        // build touserarray
        
$tostring=array($to_userid => $to_username);

        
// store the message
        
$DB_site->query("INSERT INTO " TABLE_PREFIX "pmtext\n\t(fromuserid, fromusername, title, message, touserarray, iconid, dateline, showsignature, allowsmilie)\nVALUES\n\t($from_userid, '" mysql_escape_string($from_username) . "', '"mysql_escape_string($title) ."', '"mysql_escape_string($message) ."', '" addslashes(mysql_escape_string($tostring)) . "', $iconid, " TIMENOW ", $signature$disablesmilies)");

        
// get the inserted private message id
        
$pmtextid $DB_site->insert_id();

        
// send in receiving user's inbox
        
$DB_site->query("INSERT INTO " TABLE_PREFIX "pm (pmtextid, userid) VALUES ($pmtextid$to_userid)");

        
// add to PM receiving user's total (with pm-popup)
        
$DB_site->shutdown_query("UPDATE " TABLE_PREFIX "user SET pmtotal=pmtotal+1, pmunread=pmunread+1, pmpopup=2 WHERE userid=$to_userid");
        
// ########## END SEND PM TO USER ##########
        
        // ###################################################################
        // # END WELCOME HACK
        // ###################################################################

        
if ($userinfo['coppauser'] OR ($vboptions['moderatenewmembers'] AND !$userinfo['posts'])) 
Reply With Quote
 
X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.02874 seconds
  • Memory Usage 1,847KB
  • Queries Executed 11 (?)
More Information
Template Usage:
  • (1)SHOWTHREAD_SHOWPOST
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)bbcode_php
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_box
  • (1)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (1)post_thanks_postbit_info
  • (1)postbit
  • (1)postbit_onlinestatus
  • (1)postbit_wrapper
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • reputationlevel
  • showthread
Included Files:
  • ./showpost.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_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
  • showpost_start
  • bbcode_fetch_tags
  • bbcode_create
  • postbit_factory
  • showpost_post
  • 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
  • showpost_complete