PDA

View Full Version : Opening a new thread with preset title


henrikdam
08-02-2007, 07:23 AM
Hi,
I have two questions. I really hope you can help me out:

1. I would like to have my users clicking a special link to open a new thread, and then the title/subject will be filled out already.
For example: They click the link
http://www.mysite.com/newthread.php?do=newthread&f=3&subject=MYSPECIALSUBJECT
and the new thread site opens with the title field already filled out with "MYSPECIALSUBJECT".

2. I want to be able to add an extra id to a new thread, and save it along with the other thread info in the mysql database when the users submits the new thread. It should work in the same way as the other, so when they click the link to open a new thread:
http://www.mysite.com/newthread.php?do=newthread&f=3&extraid=5000
it would add the value "5000" in a field in the database when they submit the thread.
I know how to create the field in the database, I just don't know how to add these data into it.

I hope you can help me out.

Thanks.

Kind regards
Henrik

nico_swd
08-02-2007, 08:08 AM
As for 1: install this. (Admin CP -> Plugins & Products -> Download / Upload Plugins)

This would make your special link work.

henrikdam
08-02-2007, 12:12 PM
Thanks nico_swd. It worked perfectly!

Just stuck with my question #2 now :)
I think I know the solution some of the way... But I can't figure out where in the process of starting a New Thread that the values are put in the database. Because it should be here that I need to add some extra lines...
I'm used to working with php and mysql, but with this I can't find the place in the php codes where it "INSERT"s the values into the database after submitting a new thread.
Does somebody know in what file this is hidden?

testebr
08-03-2007, 12:36 AM
nice plugin.

How to add same function to new pm form?

Opserty
08-03-2007, 09:55 AM
Hopefully nico_swd won't mind here:

(Credit to nico_swd for original code)

maasland
08-26-2008, 01:32 PM
Thanks for the plugin (1), nico_swd. It works great to place a thread title through a link, but is it also possible to add a body-message/txt to the editor as well?

Example:
http://www.mysite.com/newthread.php?do=newthread&f=3&subject=MYSPECIALSUBJECT&message=MYSPECIALMESSAGE


I'm aware that with the 'Thread Stencil' product one can put pre-defined info in, but I need to pass variables in use of the script through the link. And as I said, plugin (1) works great!

maasland
08-27-2008, 09:08 PM
Beside the fact this thread was started over a year ago :o :), I figured it out.
A new plugin in: newthread_form_start

if (empty($newpost['message']))
{
$newpost['message'] = $vbulletin->input->clean_gpc('g', 'message', TYPE_NOHTML);
}


does the trick...