The Arcive of Official vBulletin Modifications Site.It is not a VB3 engine, just a parsed copy! |
|
#1
|
|||
|
|||
post new thread using own code
heya
I am trying to change some ways of the works of vBulletin. The "normal" way - as far as I know it - is to click through the forum hierarchy to find the (sub)forum you would like to post in, then click on it, see the list of all recent posts and then click on the 'new thread' button. Now my plan is, to do it differently: the user clicks on "new thread" (or question or whatever), get a very minimalistic (like quick reply) WYSIWYG and can enter title, text etc. Then, using some AJAX and JavaScript stuff (think of suggestive search) find the right forum to post the thread into and voila that's it. Now my question is, how to best achieve this. If at all possible I would not want to duplicate newthread.php or adjust this template, but code something of my own and rely on some vBulletin API to create the form. (the whole form and steps will still be within a vBulletin environment, so I am not sure if the mobile API would work) Any thoughts? Thanks! Malte |
#2
|
|||
|
|||
Interesting. Well, I think the forum being posted in is a hidden field in the newthread form, so there's no reason you couldn't have JS set that. It's hard to say what the best way to do it would be without spending time looking in to the details, but I'd say you could either use plugins using hooks in newthread.php to modify what it does, or else copy newthread.php to a new script and modify it. You say you don't want to duplicate newthread.php, so I suppose you could make a plugin that checks for a new value for $_REQUEST['do'] and then displays a new template that you create. Then you can use the existing code in newthread.php to process the submission.
As for the forum lookup, you could use a plugin on ajax_start, since that takes advantge of the existing ajax.php to process ajax requests (it's really just a script that's set up to load only the things that an ajax request would require). In any case you can look at that file to see how vbulletin responds to ajax calls (or maybe you know how you're going to do that already). |
#3
|
|||
|
|||
Thanks for your reply!
Mhh I am not sure if I want to base this - lets call it adjustment for the sake of it - on newthread.php, meaning change the way it works. Any idea how I could piggyback onto the existing vBulletin functions / methods / checks without having to duplicate or copy them from newthread.php? I don't wan to have the hassle to keep comparing my file with the an updated newthread.php and debug it along the way if something does not work. And I am pretty sure it would be stupid to just make an SQL insert into the threads table |
#4
|
|||
|
|||
OK, well, you can look at the part of newthread.php that starts with if ($_POST['do'] == 'postthread'). Basically it builds that $newpost array then calls build_new_post() to create the thread. If you want to look at a lower level of detail, build_new_post() is in includes/functions_newpost.php, that uses a data manager to do the work of writing to the database.
I understand what you're saying about not wanting to depend on newthread.php, but you're probably going to end up creating your own version of what it does, so you probably at least want to study how it works. |
#5
|
|||
|
|||
Quote:
But it should be ok - I was just wondering whether or not there is some other way Thank you for your input! |
|
|
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
More Information | |
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|