PDA

View Full Version : Button and code to create a new thread


caimakale
07-02-2016, 09:36 PM
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 1467593017 at 1467593017 ---------------

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.

<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.