vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   Member Archives (https://vborg.vbsupport.ru/forumdisplay.php?f=202)
-   -   Creating a new thread.. (https://vborg.vbsupport.ru/showthread.php?t=24716)

AmaZed 08-06-2001 12:07 PM

I am just wondering how would I go about creating a new thread? I have scanned through the forum code a bit, but really didnt find to much where he created a new thread..

I am writing a news script, and i want to add an option 'create new thread' and it will take all the info I have for my news script and basicly create a new thread with the info givin from the news script.

If i sound fuxed up..ive been up all night codin my site..

/me will edit this for sure later

Scott MacVicar 08-06-2001 01:09 PM

I presume you mean the query to add a post

you need to do 3 queries

one to write to thread
one to write to post
and one to write to forum to update the latest post

//Create Thread
mysql_query("INSERT INTO thread (threadid, title, lastpost, forumid, pollid, open, replycount, postusername, postuserid, lastposter, dateline, views, iconid, notes, visible, sticky, votenum, votetotal, attach) VALUES ('', '" . addslashes([SUBJECT]) . "', '[UNIX TIME]', '[FORUM ID]', '0', '1', '0', '[USERNAME]', '[USERID]', '[USERNAME]', '[UNIX TIME]', '1', '1', '', '1', '0','0', '0', '0')");

//Create Posting
mysql_query("INSERT INTO post (postid, threadid, username, userid, title, dateline, attachmentid, pagetext, allowsmilie, showsignature, ipaddress, iconid, visible, edituserid, editdate) VALUES ('', '[THREADID]', '[USERNAME]', '[USERID]', '" . addslashes([SUBJECT]) . "', '[UNIX TIME]', '0', '" . addslashes(ALL TEXT) . "', '1', '0', '127.0.0.1', '1', '1', '0', '0')");

//Update Forum Info
mysql_query("UPDATE forum SET replycount=replycount+1,threadcount=threadcount+1, lastpost='[UNIX TIME]',lastposter='" . addslashes([USERNAME]) . "' WHERE forumid='[FORUMID]'");

[UNIX TIME] <= time in seconds after 1970
[SUBJECT] <= Post Subject
[FORUMID] <= ID of forum this one is number 8
[USERNAME] <= Name as it will appear in post
[USERID] <= User ID of the person posting yours is 7197
[THREADID] <= ID of the thread post is associated with
[ALL TEXT] <= stuff to be in post

thats pretty much everything, if you have any more problems I will help.

AmaZed 08-06-2001 02:40 PM

thanks! just what i needed

Scott MacVicar 08-06-2001 03:51 PM

Yeah no problem

I already done a comment system for nPHP v215

suggestion though, when they edit the news post, they edit the thread.

If they delete the news post, they delete the thread.

:)


All times are GMT. The time now is 11:42 AM.

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.00945 seconds
  • Memory Usage 1,713KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (4)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.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/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • printthread_start
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete