vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB5 Programming Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=263)
-   -   Button and code to create a new thread (https://vborg.vbsupport.ru/showthread.php?t=322963)

caimakale 07-02-2016 09:36 PM

Button and code to create a new thread
 
I've created custom search modules for two different channels on my website. These modules are displayed on my home page. When a user clicks on the "View All" button, it takes them to the actual channel, rather than return a bunch of search results.

I'm looking to add one more button to each module...I'd like my users to be able to "Post an ad" directly from the module. What I mean by this is, if they click the button, it will begin the process of creating a new topic within the predefined channel.

Is it possible? Anyone have code to accomplish this in VB5?

Replicant 07-03-2016 03:00 AM

Yes, it's possible. I have the basic code somewhere. I'll have to do some digging to find it.

--------------- Added [DATE]1467593017[/DATE] at [TIME]1467593017[/TIME] ---------------

I found my notes.
This is the basic form with the minimum requirements to start a new thread, reply, or comment. It is in no way intended to be a production design, but more as a guideline.

The security token is available via js variable pageData.securitytoken.

The forum to post to is a different story. You will need to come up with a way to find the nodeid's of the forums you wish to post the new thread to and auto fill the form for each result probably with JS and regex.

securitytoken - self explanatory
title - The title of the new thread
parentid - The nodeid of the forum to start the new thread in
text - The content portion of the first post in the new thread. This is SQL/HTML safe since it is going through the vBulletin filters AND BBCode is allowed.

Code:

<form action="http://www.k5blazersplus.com/forum/create-content/text/" method="post">
                <input type="hidden" name="securitytoken" value="Use Javascript to insert security token here on page load">
                Title:<br>
                <input type="text"  name="title"><br>
                Forum:<br>
                <input type="hidden" name="parentid" default="Nodeid of forum to post to"><br>
                Text:<br>
                <input type="text" name="text"><br>
                <input type="submit" value="Submit">
                </form>

Once you understand this code, you may decide to design a free floating popup template that encompasses the CKEditor to give your users a full featured interface.


All times are GMT. The time now is 02:14 PM.

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.00986 seconds
  • Memory Usage 1,715KB
  • 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)bbcode_code_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (2)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