Go Back   vb.org Archive > vBulletin 4 Discussion > vB4 Programming Discussions
FAQ Community Calendar Today's Posts Search

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #1  
Old 04-13-2013, 07:55 AM
ExcelFox ExcelFox is offline
 
Join Date: Apr 2011
Posts: 24
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default <vb:if condition="$bbuserinfo[userid]"> Not Working

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
Code:
<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
Code:
<div class="bbcode_container">
	<div class="bbcode_description">{vb:rawphrase code}:&nbsp;<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

Code:
<div class="bbcode_container">
	<div class="bbcode_description">{vb:rawphrase code}:&nbsp;<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 [DATE]1365846255[/DATE] at [TIME]1365846255[/TIME] ---------------

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

Code:
<div class="bbcode_container">
	<div class="bbcode_description">{vb:rawphrase code}:&nbsp;<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>
Reply With Quote
 


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 02:28 PM.


Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2024, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.05601 seconds
  • Memory Usage 2,655KB
  • Queries Executed 12 (?)
More Information
Template Usage:
  • (1)SHOWTHREAD
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)ad_showthread_beforeqr
  • (13)bbcode_code
  • (1)bbcode_php
  • (3)bbcode_quote
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)navbar
  • (3)navbar_link
  • (120)option
  • (14)post_thanks_box
  • (14)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (14)post_thanks_postbit_info
  • (14)postbit
  • (14)postbit_onlinestatus
  • (14)postbit_wrapper
  • (1)showthread_list
  • (1)spacer_close
  • (1)spacer_open
  • (1)tagbit_wrapper 

Phrase Groups Available:
  • global
  • inlinemod
  • postbit
  • posting
  • reputationlevel
  • showthread
Included Files:
  • ./showthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/functions_bigthree.php
  • ./includes/class_postbit.php
  • ./includes/class_bbcode.php
  • ./includes/functions_reputation.php
  • ./includes/functions_threadedmode.php
  • ./includes/functions_post_thanks.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_postinfo_query
  • fetch_postinfo
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • showthread_start
  • showthread_getinfo
  • forumjump
  • showthread_post_start
  • showthread_query_postids_threaded
  • showthread_threaded_construct_link
  • showthread_query
  • bbcode_fetch_tags
  • bbcode_create
  • showthread_postbit_create
  • postbit_factory
  • postbit_display_start
  • post_thanks_function_post_thanks_off_start
  • post_thanks_function_post_thanks_off_end
  • post_thanks_function_fetch_thanks_start
  • post_thanks_function_fetch_thanks_end
  • post_thanks_function_thanked_already_start
  • post_thanks_function_thanked_already_end
  • fetch_musername
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete