Go Back   vb.org Archive > vBulletin 4 Discussion > vB4 Programming Discussions
  #1  
Old 04-06-2015, 06:45 PM
ub.ch ub.ch is offline
 
Join Date: Jul 2010
Posts: 49
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default 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
Reply With Quote
  #2  
Old 04-07-2015, 09:46 AM
kh99 kh99 is offline
 
Join Date: Aug 2009
Location: Maine
Posts: 13,185
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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).
Reply With Quote
  #3  
Old 04-07-2015, 07:32 PM
ub.ch ub.ch is offline
 
Join Date: Jul 2010
Posts: 49
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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
Reply With Quote
  #4  
Old 04-07-2015, 07:41 PM
kh99 kh99 is offline
 
Join Date: Aug 2009
Location: Maine
Posts: 13,185
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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.
Reply With Quote
  #5  
Old 04-08-2015, 06:41 AM
ub.ch ub.ch is offline
 
Join Date: Jul 2010
Posts: 49
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by kh99 View Post
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.
I guess there is no other option then
But it should be ok - I was just wondering whether or not there is some other way

Thank you for your input!
Reply With Quote
Reply

Thread Tools
Display Modes

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 04:43 PM.


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.06597 seconds
  • Memory Usage 2,191KB
  • Queries Executed 13 (?)
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
  • (1)ad_showthread_firstpost
  • (1)ad_showthread_firstpost_sig
  • (1)ad_showthread_firstpost_start
  • (1)bbcode_quote
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)navbar
  • (3)navbar_link
  • (120)option
  • (5)post_thanks_box
  • (5)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (5)post_thanks_postbit_info
  • (5)postbit
  • (5)postbit_onlinestatus
  • (5)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