PDA

View Full Version : vBulletin Prefix Variables


MoMan
07-18-2008, 07:21 PM
Does anyone happen to know what the vBulletin variable for prefixes is?

I'm currently trying to customize the form hack for vBulletin 3.7, and I won't be able to use it unless I can get it to specify a thread prefix based on a radio button field.

Dismounted
07-19-2008, 03:55 AM
$threadinfo[prefix_plain_html]
$threadinfo[prefix_rich]

MoMan
07-21-2008, 10:22 AM
Thanks. Should those variables contain strings, or just the prefix IDs assiged from the admin panel?

Dismounted
07-21-2008, 11:39 AM
They will contain the string (ie. the actual prefix text).

MoMan
07-21-2008, 05:11 PM
Thanks again for the quick reply!

Given I enter the prefix strings into the admin panel using the same HTML as below, would this code work and apply a thread prefix? Below is an excerpt from the Form Hack mod which I'm trying to adapt to my 3.7 installation.

if ($radioanswer1 == "Selling")
{
$prefix == "<span style="color: green"><b>For Sale</span>:</b>"
}

if ($radioanswer1 == "Trading")
{
$prefix == "<span style="color:darkgreen"><b>For Trade</span>:</b>"
}

if ($radioanswer1 == "Selling or Trading")
{
$prefix == "<span style="color:darkgreen"><b>For Sale or Trade</span>:</b>"
}

...
$newpost['username'] =& $vbulletin->userinfo['username'];
$newpost['message'] =& $formsend;
$newpost['title'] =& $posttitle;
$newpost['prefix_rich'] =& $prefix;
$newpost['parseurl'] = '1';
$newpost['poststarttime'] = $poststarttime;
$newpost['posthash'] = $posthash;

...

--------------- Added 1216664523 at 1216664523 ---------------

Edit: it looks like I need to use the $newpost[prefixid] variable instead, from what I can tell!

--------------- Added 1216682829 at 1216682829 ---------------

Got everything working now- see here for more details: https://vborg.vbsupport.ru/showthread.php?p=1580951#post1580951

Now the Form Hack will be able to add prefixes to the threads it creates as well.