$forum[newoption] is from the options when editing a forum. I've added a new option there:
hook: forumadmin_edit_form
PHP Code:
print_table_header($vbphrase['teh_forumicon']);
print_input_row($vbphrase['teh_forumicon_desc'], 'forum[iconlocation]', $forum['iconlocation']);
I then validated the data:
hook: forumdata_start
PHP Code:
$this->validfields['iconlocation'] = array(TYPE_STR, REQ_NO);
I also added a iconlocation field to the forum table in my database. That part works as spected. It saves the data.
Now using the variable directly into my template it works as spected too: $forum[iconlocation] as {vb:raw forum.iconlocation}
The problem is trying to insert that variable using a plugin:
PHP Code:
$find = '<p class="forumdescription">';
$insert = '<img src="'.$forum[iconlocation].'" alt="'.$forum[title].'" />';
$vbulletin->templatecache['forumhome_forumbit_level2_post'] = str_replace($find,$find.$insert, $vbulletin->templatecache['forumhome_forumbit_level2_post']);
var_dump($forum[iconlocation]);
I've attaced a screenshot so you can see what i'm talking about.
Also the output for var_dump($forum[iconlocation]); is
Code:
string(31) "images/misc/skype_voicemail.gif" string(32) "images/misc/skype_addcontact.gif" string(0) ""