Log in

View Full Version : Extra Fields


Digital Jedi
05-07-2008, 01:31 PM
I was just wondering if this information was still up to date and if it does what I think it does. I'd like to use it to create extra fields when a user starts a thread, but have the fields specific to certain forums.


Hook Location: newthread_post_start

// Clean input
$vbulletin->input->clean_array_gpc('p', array(
'url' => TYPE_STR,
'img' => TYPE_STR,
'info' => TYPE_NOHTML,
'trailer' => TYPE_NOHTML
));

// Assign the input to go to the builder
$newpost['url'] = $vbulletin->GPC['url'];
// Repeat for others


Hook Location: postdata_start

// Set our custom valid fields
$this->validfields['url'] = array(TYPE_STR, REQ_NO);
// Repeat for others

Hook Location: newpost_process

// Set the input data to the custom fields
$dataman->setr('url', $post['url']);
// Repeat for others


Now you need to edit the newthread template with the correct input boxes which have the names 'url', 'img', 'info' and 'trailer'.

I hope I haven't missed anything out but I think that it is pretty much it.

EDIT: I don't know if you can overwrite the message text with the txtDesc using plugins. Why not just ask the user to input the description as the content of the post? It would be far easier to do it that way :p