Go Back   vb.org Archive > vBulletin Modifications > Archive > vB.org Archives > vBulletin 3.0 > vBulletin 3.0 Full Releases
FAQ Community Calendar Today's Posts Search

Reply
 
Thread Tools
Auto-Create Discussion Thread (when posting new thread) Details »»
Auto-Create Discussion Thread (when posting new thread)
Version: 1.00, by Tekton Tekton is offline
Developer Last Online: Jun 2009 Show Printable Version Email this Page

Version: 3.0.6 Rating:
Released: 01-26-2005 Last Update: 01-26-2005 Installs: 4
 
No support by the author.

___________
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:
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]$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! ')");[/sql]
OR this SQL query (not tested)
[sql]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! ');
[/sql]

// ###### 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)

Show Your Support

  • This modification may not be copied, reproduced or published elsewhere without author's permission.

Comments
  #2  
Old 01-27-2005, 09:27 AM
Tekton Tekton is offline
 
Join Date: Jun 2004
Location: Wisconsin
Posts: 362
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

If you want to change what the button says, there are two things you need to change in the newthread.php (should probably have been one, but oh well ^^)
Find:
PHP Code:
if($_REQUEST['discuss']=='Submit + Discussion Thread' && $dcs_chk[0]==$dcs_mkr[3] && $this_forum==$dcs_mkr[0]){ 
Change to:
PHP Code:
if($_REQUEST['discuss']=='WHATEVER YOU WANT' && $dcs_chk[0]==$dcs_mkr[3] && $this_forum==$dcs_mkr[0]){ 
//------
Find:
PHP Code:
<input type='submit' class='button' name='discuss' value='Submit + Discussion Thread' accesskey='d'/> 
Change the value tag to the exact same text as your changed above.


????????????????????
If you don't want to add that large amount of code to your newthread.php, you can add this instead instead:
PHP Code:
require_once('./includes/functions_discussion_maker.php'); 
Then, place the attached file into your includes folder~
Reply With Quote
  #3  
Old 01-27-2005, 10:03 AM
nexialys
Guest
 
Posts: n/a
Default

hum.. this hack is amazing for me... THANKS Tekton for the idea !!
Reply With Quote
  #4  
Old 01-27-2005, 12:00 PM
jluerken's Avatar
jluerken jluerken is offline
 
Join Date: Aug 2003
Location: Germany
Posts: 1,016
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Hi Tekton,

pretty cool. Thanks for writing a hack out of my suggestion.

This thing is not clear to me:
Quote:
If you don't want to add that large amount of code to your newthread.php, you can add this instead instead:
Can you tell us where to place this line and what else you then don't have to add somewhere else?

I am looking forward to see your pseudo-UserCP and the HostingCP.
I'll write you a PM about the last thing.

Thanks man!
Reply With Quote
  #5  
Old 01-27-2005, 03:02 PM
Tekton Tekton is offline
 
Join Date: Jun 2004
Location: Wisconsin
Posts: 362
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Hi. Basically I mean placing the last bit of code (the really long part) into a seperate php file and then just including it into the newthread.php with the 'require_once' function mentioned above. The code in the functions_discussion_maker.php is the same as listed in that last one (only change is that it's wrapped in php tags - <?php ?)
Reply With Quote
  #6  
Old 01-28-2005, 04:16 PM
jluerken's Avatar
jluerken jluerken is offline
 
Join Date: Aug 2003
Location: Germany
Posts: 1,016
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Very great hack. Its working fine. Thanks man
Reply With Quote
  #7  
Old 01-28-2005, 07:15 PM
jluerken's Avatar
jluerken jluerken is offline
 
Join Date: Aug 2003
Location: Germany
Posts: 1,016
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Hi,

there is a small bug in
PHP Code:
$_POST['message']=$_POST['message']."\n [url=".$vboptions[homeurl]."showthread.php?t=".$newtid[threadid]."]".$dcs_mkr[4]."[/url]";}}
// ###### END DISCUSSION MAKER CREATE ###### 
This construct
PHP Code:
.$vboptions[homeurl].
makes links like:
http://www.url.comshowthread.php

There is a / missing and also the forum directory.

For example:
My board must have this link: http://www.url.com/forum/showthread.php

I changed this:
PHP Code:
$_POST['message']=$_POST['message']."\n [url=".$vboptions[homeurl]."showthread.php?t=".$newtid[threadid]."]".$dcs_mkr[4]."[/url]";}}
// ###### END DISCUSSION MAKER CREATE ###### 
to:
PHP Code:
$_POST['message']=$_POST['message']."\n [url=".$vboptions[homeurl]."/forum/showthread.php?t=".$newtid[threadid]."]".$dcs_mkr[4]."[/url]";}}
// ###### END DISCUSSION MAKER CREATE ###### 
which is working fine for me.
If another user has installed his board in http://www.url.com/board change
the above /forum/ to /board/

Reply With Quote
  #8  
Old 01-28-2005, 07:21 PM
Tekton Tekton is offline
 
Join Date: Jun 2004
Location: Wisconsin
Posts: 362
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Ah, yeah sorry we use the base directory for all of our forums~ ^^;;

Replace $vboptions[homeurl] with $vboptions[bburl]
Reply With Quote
  #9  
Old 07-31-2005, 05:20 PM
MoogleCC MoogleCC is offline
 
Join Date: Jun 2005
Posts: 3
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Text in this field will be added to the bottom of the original thread in the form of a link that will take the user to the Discussion thread. (cannot use '~')
but this doesn`t work
maybe because of 3.0.7 ????
Reply With Quote
  #10  
Old 10-09-2005, 09:03 AM
jluerken's Avatar
jluerken jluerken is offline
 
Join Date: Aug 2003
Location: Germany
Posts: 1,016
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Tekton could you create this also for vB 3.5?
Reply With Quote
Reply


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 09:15 AM.


Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2024, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.06950 seconds
  • Memory Usage 2,362KB
  • Queries Executed 25 (?)
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
  • (12)bbcode_php
  • (2)bbcode_quote
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)modsystem_post
  • (1)navbar
  • (6)navbar_link
  • (120)option
  • (10)post_thanks_box
  • (10)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (10)post_thanks_postbit_info
  • (9)postbit
  • (9)postbit_onlinestatus
  • (10)postbit_wrapper
  • (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_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
  • 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