Back to vBulletin 3.0 Add-Ons

Auto-Create Discussion Thread (when posting new thread)
Mod Version: 1.00, by Tekton

This modification is in the archives.
vB Version: 3.0.6 Rating: (0 vote - 0 average) Installs: 4
Released: 27 Jan 2005 Last Update: 27 Jan 2005 Downloads: 20
Not Supported  

___________
If you installed before 01/28/05, you should search through the added code to newthread.php and replace $vboptions[homeurl] with $vboptions[bburl]. There is one occurrence of this.

¯¯¯¯¯¯¯¯¯¯¯

Discussion Threads Requested Here

Estimated Time: ~5 minutes [Any questions? This thread only please ]

What is it: Adds a button in the new thread creation that will auto-create a discussion thread. Useful for posting in a forum that is locked to normal users and gives them a place to discuss it.

Options: Global ON/OFF, Start Forum, End Forum, Allow Discussion Thread creation by usergroup or user, text to addon to the original thread, text to add before or after Discussion Thread title, and starting text in the new Discussion Thread. (SEE IMAGES)

Images:
  • http://www.tektek.org/vbhack/discussion_maker/img_newthread.png
  • http://www.tektek.org/vbhack/discussion_maker/img_options.png

Possible Changes: using the vboptions instead of a seperate (kinda sloppy) page to set the values. I dislike vboptions, but anyone can feel free to do this! Also, multiple usergroups and users instead of just a single (not too hard) ANYONE IS FREE TO CHANGE THIS OR MAKE IT BETTER!

// ###### INSTALLATION ######
Currently, I'm storing the data in a row on the adminutil table (it's kinda empty).
You can run the attached file (discussion_maker_install.php) from your admin directory, or just run this vB query for initial setup:
SQL Query: (how to run queries)
$DB_site->query("INSERT INTO ".TABLE_PREFIX."adminutil('title', 'text') VALUES
('discussion_maker', '0~0~0~999999~[Discuss this Announcement]~1~Discussion~unchecked~Please feel free to discuss! :)')");
OR this SQL query (not tested)
SQL Query: (how to run queries)
INSERT INTO YOUR_DB.adminutil ('title', 'text')
VALUES
('discussion_maker', '0~0~0~999999~[Discuss this Announcement]~1~Discussion~unchecked~Please feel free to discuss! :)');

// ###### SETUP ######
Place the attached file (discussion_maker.php) into your admin directory.
____________________
OPTIONAL: If you want a link to it from your admin panel; in your admin index.php find:
PHP Code:
construct_nav_group($vbphrase['vbulletin_options'], '<hr />'); 
Add AFTER:
PHP Code:
// #### START DISCUSSION MAKER
   
construct_nav_option('Discussion Maker Options''discussion_maker.php?do=view');
   
construct_nav_group('Discussion Maker');
// #### END DISCUSSION MAKER 
¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯
In your newthread template, add "$discussion_maker" (without quotes) wherever you want it to show up in the template. (as long as it's inside the <form> tags)
¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯
In newthread.php, find:
PHP Code:
require_once('./includes/functions_bigthree.php'); 
Add AFTER:
PHP Code:
// ###### DISCUSSION MAKER CREATE ######
$discuss $DB_site->query_first("SELECT title, text FROM ".TABLE_PREFIX."adminutil WHERE title = 'discussion_maker'"); 
$this_forum=$_REQUEST['f']; $dcs_mkr explode("~"$discuss[text]);
if(
$dcs_mkr[2]==0){$dcs_chk[0]=$bbuserinfo[usergroupid];}if($dcs_mkr[2]==1){$dcs_chk[0]=$bbuserinfo[userid];}
// for debug --> echo $dcs_chk[0]." ?= ".$dcs_mkr[3]." ~~~ ".$this_forum." ?= ".$dcs_mkr[0];
if($_REQUEST['discuss']=='Submit + Discussion Thread' && $dcs_chk[0]==$dcs_mkr[3] && $this_forum==$dcs_mkr[0]){

$dcs_mkr explode("~"$discuss[text]);
if(
$dcs_mkr[2]==0){$dcs_chk[0]=$bbuserinfo[usergroupid];}if($dcs_mkr[2]==1){$dcs_chk[0]=$bbuserinfo[userid];}
if(
$dcs_chk[0]==$dcs_mkr[3]){
if(
$dcs_mkr[5]==0){$mkr1=$dcs_mkr[6];}if($dcs_mkr[5]==1){$mkr2=$dcs_mkr[6];}
$new_thread_title=$mkr1." ".$_POST['subject']." ".$mkr2;

// Creating Thread
$DB_site->query("INSERT INTO ".TABLE_PREFIX."thread(
title, lastpost, forumid, open, replycount, postusername, postuserid, lastposter, dateline, iconid, visible) VALUES('
addslashes(htmlspecialchars($new_thread_title)) . "', " TIMENOW ", $dcs_mkr[1], 1, 0, 
'"
addslashes($bbuserinfo[username]) ."', $bbuserinfo[userid],'"addslashes($bbuserinfo[username]) ."', " TIMENOW ", 0, 1)");
$threadinfo['threadid'] = $DB_site->insert_id();

// Creating Post
$DB_site->query("INSERT INTO ".TABLE_PREFIX."post(
threadid, parentid, title, username, userid, dateline, pagetext, allowsmilie, showsignature, ipaddress, iconid, visible) VALUES
(
$threadinfo[threadid], 0, '" addslashes(htmlspecialchars($new_thread_title)) . "', '" addslashes($bbuserinfo[username]) . "', 
$bbuserinfo[userid], " TIMENOW ", '" addslashes($dcs_mkr[8]) . "', 1, 1, 0, 0, 1)");
        
$post['postid'] = $DB_site->insert_id();
$DB_site->query("UPDATE ".TABLE_PREFIX."thread SET firstpostid = $post[postid] WHERE threadid = $threadinfo[threadid]");
require_once(
'./includes/functions_databuild.php');

build_post_index($post['postid'], $foruminfoiif($type == 'thread'10));

// update forum stuff
$DB_site->query("UPDATE " TABLE_PREFIX "forum 
SET replycount = replycount +  1, threadcount = threadcount + 1, 
lastpost = " 
TIMENOW ", lastposter = '" addslashes($bbuserinfo[username]) . "', 
lastthread = '" 
addslashes(htmlspecialchars($new_thread_title)) . "', 
lastthreadid = 
$threadinfo[threadid] WHERE forumid = $dcs_mkr[1]");

$newtid $DB_site->query_first("SELECT dateline, threadid FROM ".TABLE_PREFIX."thread WHERE postuserid = '$bbuserinfo[userid]' ORDER BY dateline DESC");
$_POST['message']=$_POST['message']."\n [url=".$vboptions[bburl]."showthread.php?t=".$newtid[threadid]."]".$dcs_mkr[4]."[/url]";}}
// ###### END DISCUSSION MAKER CREATE ######

// ###### DISCUSSION MAKER SHOW ######
if($dcs_chk[0]==$dcs_mkr[3] && $this_forum==$dcs_mkr[0]){
if(
$dcs_mkr[7]=="checked"){$discussion_maker="<input type='submit' class='button' name='discuss' value='Submit + Discussion Thread' accesskey='d'/>";}}
// ###### END DISCUSSION MAKER SHOW ###### 
// =======================

DONE! Make sure you configure the setup in discussion_maker.php. Tell me if there's any problems; it's possible I missed something in the instructions. This hack has been tested and does work~ Use at your own risk! (I'm not responsible, etc etc)

Download

This modification is archived and cannot be downloaded.


vblts.ru supports vBulletin®, 2022-2024