The Arcive of Official vBulletin Modifications Site.It is not a VB3 engine, just a parsed copy! |
|
#1
|
|||
|
|||
Need help finding proper location for new thread code in register.php...
I set my forum up to auto generate a thread for our new users after they confirm the email address. The code works, but not all the time. I'm guessing that I have it in the wrong area in the register.php script. Can someone here point me to where it should go?
I suck at PHP coding, so thanks for your help. Here is the code I'm using: PHP Code:
PHP Code:
|
#2
|
||||
|
||||
What version of Vbulletin are you using?
|
#3
|
|||
|
|||
Sorry. Good question. vB 3.0.3
|
#4
|
||||
|
||||
It looks like it's in the right spot. Can you be more specific about when it does or doesn't work? What's different in the users or situation when it fails?
Amy |
#5
|
|||
|
|||
most of the time, the thread is created. Sometimes it isn't. I can't see anything different about the user's profiles...
Thanks for your responses!!! |
#6
|
|||
|
|||
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:
|
#7
|
||||
|
||||
Use $user, not $bbuserinfo.
Amy |
#8
|
|||
|
|||
Quote:
|
#9
|
||||
|
||||
Try this:
Code:
// delete activationid //$DB_site->query("DELETE FROM " . TABLE_PREFIX . "useractivation WHERE userid=$userinfo[userid] AND type=0"); // ################################################################### // # WELCOME HACK // ################################################################### $username = $user['username']; $userid = $user['userid']; //$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] . $user['userid'] . $user['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 = $user['userid']; $to_username = $user['username']; $title = "Important information regarding your registration!"; $message = "Pending your full approval, we have created a thread for you. The thread is located here. 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 // ################################################################### |
#10
|
|||
|
|||
I shall try that. Thanks!
fdsfsdfsfsdfsdf Hmmm... That didn't seem to work. The PM never got sent and the thread title that got created didn't include their name. The thread title = $pmoptions['regpmtitle'] = $vboptions['regpmtitle'] = Please welcome $username to UF fsdafsdfafdsfdsa wtf, it keeps merging my posts. Please see my reply above about it not working... |
|
|
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
More Information | |
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|