ExcelFox
04-13-2013, 07:55 AM
I am trying to have my BBCODE contents not viewable unless the user is logged in. I found a hack from this forum that will allow conditionals in BBCODE. I've installed that too.
What I'm trying to do is use
<vb:if condition="$bbuserinfo[userid]">
'Something here
<vb:else />
'Something else here
</vb:if>
When I try to do it as below, it gives me an error when the page is loaded
<div class="bbcode_container">
<div class="bbcode_description">{vb:rawphrase code}: <input type="button" value="Click To Select" onclick="selectAll(this); return false;"></div>
<pre class="bbcode_code"<vb:if condition="$vboptions['codemaxlines']">style="height:<vb:if condition="$blockheight<$vboptions['codemaxlines']">{vb:math {vb:raw blockheight}*{vb:stylevar mid_fontSize}+{vb:stylevar mid_fontSize}*2}<vb:else />{vb:math {vb:raw blockheight}*{vb:stylevar mid_fontSize}+{vb:stylevar mid_fontSize}}</vb:if>;"</vb:if>>
<code>
<vb:if condition="$bbuserinfo[userid]">
{vb:raw code}
<vb:else />
<b><font color="green">Hello Guest!</font></b>
<font color="black"><p>To post questions, download files, to provide solutions to queries and <b>especially to view this code</b>, <a href="register.php"><u>register for free!</u></a></p>
</vb:if>
</code>
</pre>
</div>
The original code that works is below
<div class="bbcode_container">
<div class="bbcode_description">{vb:rawphrase code}: <input type="button" value="Click To Select" onclick="selectAll(this); return false;"></div>
<pre class="bbcode_code"<vb:if condition="$vboptions['codemaxlines']">style="height:<vb:if condition="$blockheight<$vboptions['codemaxlines']">{vb:math {vb:raw blockheight}*{vb:stylevar mid_fontSize}+{vb:stylevar mid_fontSize}*2}<vb:else />{vb:math {vb:raw blockheight}*{vb:stylevar mid_fontSize}+{vb:stylevar mid_fontSize}}</vb:if>;"</vb:if>><code>{vb:raw code}</code></pre>
</div>
Any idea what's going wrong?
--------------- Added 1365846255 at 1365846255 ---------------
This isn't throwing any error. However, I am not getting the message for a guest. Instead, I am getting the actual contents of the BBCode even if a user is logged in or not
<div class="bbcode_container">
<div class="bbcode_description">{vb:rawphrase code}: <input type="button" value="Click To Select" onclick="selectAll(this); return false;"></div>
<pre class="bbcode_code"<vb:if condition="$vboptions['codemaxlines']">style="height:<vb:if condition="$blockheight<$vboptions['codemaxlines']">{vb:math {vb:raw blockheight}*{vb:stylevar mid_fontSize}+{vb:stylevar mid_fontSize}*2}<vb:else />{vb:math {vb:raw blockheight}*{vb:stylevar mid_fontSize}+{vb:stylevar mid_fontSize}}</vb:if>;"</vb:if>>
<code>
<vb:if condition="$bbuserinfo[userid]">
<b><font color="green">Hello Guest!</font></b>
<font color="black"><p>To post questions, download files, to provide solutions to queries and <b>especially to view this code</b>, <a href="register.php"><u>register for free!</u></a></p>
<vb:else />
{vb:raw code}
</vb:if>
</code>
</pre>
</div>
What I'm trying to do is use
<vb:if condition="$bbuserinfo[userid]">
'Something here
<vb:else />
'Something else here
</vb:if>
When I try to do it as below, it gives me an error when the page is loaded
<div class="bbcode_container">
<div class="bbcode_description">{vb:rawphrase code}: <input type="button" value="Click To Select" onclick="selectAll(this); return false;"></div>
<pre class="bbcode_code"<vb:if condition="$vboptions['codemaxlines']">style="height:<vb:if condition="$blockheight<$vboptions['codemaxlines']">{vb:math {vb:raw blockheight}*{vb:stylevar mid_fontSize}+{vb:stylevar mid_fontSize}*2}<vb:else />{vb:math {vb:raw blockheight}*{vb:stylevar mid_fontSize}+{vb:stylevar mid_fontSize}}</vb:if>;"</vb:if>>
<code>
<vb:if condition="$bbuserinfo[userid]">
{vb:raw code}
<vb:else />
<b><font color="green">Hello Guest!</font></b>
<font color="black"><p>To post questions, download files, to provide solutions to queries and <b>especially to view this code</b>, <a href="register.php"><u>register for free!</u></a></p>
</vb:if>
</code>
</pre>
</div>
The original code that works is below
<div class="bbcode_container">
<div class="bbcode_description">{vb:rawphrase code}: <input type="button" value="Click To Select" onclick="selectAll(this); return false;"></div>
<pre class="bbcode_code"<vb:if condition="$vboptions['codemaxlines']">style="height:<vb:if condition="$blockheight<$vboptions['codemaxlines']">{vb:math {vb:raw blockheight}*{vb:stylevar mid_fontSize}+{vb:stylevar mid_fontSize}*2}<vb:else />{vb:math {vb:raw blockheight}*{vb:stylevar mid_fontSize}+{vb:stylevar mid_fontSize}}</vb:if>;"</vb:if>><code>{vb:raw code}</code></pre>
</div>
Any idea what's going wrong?
--------------- Added 1365846255 at 1365846255 ---------------
This isn't throwing any error. However, I am not getting the message for a guest. Instead, I am getting the actual contents of the BBCode even if a user is logged in or not
<div class="bbcode_container">
<div class="bbcode_description">{vb:rawphrase code}: <input type="button" value="Click To Select" onclick="selectAll(this); return false;"></div>
<pre class="bbcode_code"<vb:if condition="$vboptions['codemaxlines']">style="height:<vb:if condition="$blockheight<$vboptions['codemaxlines']">{vb:math {vb:raw blockheight}*{vb:stylevar mid_fontSize}+{vb:stylevar mid_fontSize}*2}<vb:else />{vb:math {vb:raw blockheight}*{vb:stylevar mid_fontSize}+{vb:stylevar mid_fontSize}}</vb:if>;"</vb:if>>
<code>
<vb:if condition="$bbuserinfo[userid]">
<b><font color="green">Hello Guest!</font></b>
<font color="black"><p>To post questions, download files, to provide solutions to queries and <b>especially to view this code</b>, <a href="register.php"><u>register for free!</u></a></p>
<vb:else />
{vb:raw code}
</vb:if>
</code>
</pre>
</div>