Hello everybody! I have one problem with porting one of my products to VB4.
I have the setting for a product called
vfsms_can_stick_by_sms - it's comma separated list of forum-sections where this product is turned on.
In this product I have the following plugin:
Code:
<plugin active="1" executionorder="5">
<title>Detecting can thread in this forum can be stick up by SMS or not.</title>
<hookname>showthread_start</hookname>
<phpcode>
<![CDATA[
$vfsms_can_stick_by_sms_forums_ids = str_replace(' ', '', $vbulletin->options['vfsms_can_stick_by_sms']);
$vfsms_allowed4sticky_forums = explode(',', $vfsms_can_stick_by_sms_forums_ids);
// I've already read article from this forum abt passing variables to the template engine
vB_Template::preRegister('SHOWTHREAD', array('vfsms_allowed4sticky_forums' => $vfsms_allowed4sticky_forums));
]]>
</phpcode>
</plugin>
And in template
SHOWTHREAD I have next conditional:
Code:
{vb:raw $vfsms_allowed4sticky_forums}
{vb:raw $forumid}
<table cellpadding="0" cellspacing="0" border="0" width="100%" style="margin:10px">
<tr>
<td align="center">
<vb:if condition="$vbulletin->userinfo['userid'] == $threadinfo['postuserid'] AND ($threadinfo['sticky_till'] != '0000-00-00 00:00:00' AND $threadinfo['sticky'] == 1)">
Your thread is sticky untill <b style="color: red;">{vb:raw threadinfo.sticky_till}</b>!<br />
For prolongation send sms with the text <b style="color: red;">#vf sticky {vb:raw threadinfo.threadid}</b> to the number <b style="color: blue;">{$vbulletin->options[vfsms_sticky_num]}</b>.
<vb:elseif condition="$vbulletin->userinfo['userid'] == $threadinfo['postuserid'] AND $threadinfo['sticky_till'] == '0000-00-00 00:00:00' AND $threadinfo['sticky'] == 0 AND in_array($forumid, $vfsms_allowed4sticky_forums)" />
You can make your topic sticky by sending SMS with text <b style="color: red;">#vf sticky {vb:raw threadinfo.threadid}</b> to the number <b style="color: blue;">{$vbulletin->options[vfsms_sticky_num]}</b>.
<vb:else />
You can not make your topic sticky.
</vb:if>
</td>
</tr>
</table>
I have few problems:
1. variable
$vfsms_allowed4sticky_forums can be accessed only as a {vb:raw vfsms_allowed4sticky_forums} and I can not put it to the condition
2. variable
$forumid is not accessible anymore
Please, somebody, help me!
--------------- Added [DATE]1262737717[/DATE] at [TIME]1262737717[/TIME] ---------------
but everything is ok if I pass variable directly from the
showthread.php:
Code:
1. find showthread.php:2228 print_output($templater->render());
2. replace on
Code:
$vfsms_can_stick_by_sms_forums_ids = str_replace(' ', '', $vbulletin->options['vfsms_can_stick_by_sms']);
$vfsms_allowed4sticky_forums = explode(',', $vfsms_can_stick_by_sms_forums_ids);
$templater->register('vfsms_allowed4sticky_forums', $vfsms_allowed4sticky_forums);
print_output($templater->render());
and in template also replace
$forumid on
$thread[forumid]
This is absolutely wrong way of doing the thing I need, pls tell me how to do it without changes in showthread.php!