vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB4 Programming Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=252)
-   -   Using conditionals and vb code on VB4 CMS pages (https://vborg.vbsupport.ru/showthread.php?t=270031)

princesspepper 09-10-2011 12:51 PM

Using conditionals and vb code on VB4 CMS pages
 
Hi there. Just posted this on .com, but after searching, I'm not sure if I should post it here instead... it's a bit confusing knowing where to post what... but here goes :)

I have some code on a page that I want to display only to certain usergroups and I also want to include their username if they are allowed to see it. How would I write this, and do I have to use a PHP or Static HTML content type in order to do it?

This is what I can gather I should do... is it correct?...

Code:

<vb:if condition="is_member_of($bbuserinfo, 5,6,7)">


<div>
<p>Hello {vb:raw bbuserinfo.username},</p>


<p>Stuff for admins is displayed here</p>
</div>


<vb:else />


<p>I'm sorry. You are not authorized to view this page.</p>


</vb:if>

at the moment this is not working if I put the code in an HTML content page, so I'm not sure what's going wrong.

Thanks for any help in advance!

Lynne 09-10-2011 04:30 PM

An html content page (static page?) may only contain straight html. Conditions are not real html. If you want a page that interacts with your users, then you would need a PHP Direct Eval page. And, you should do the condition via the permissions area of the CMS (admincp > vbulletin cms > permissions) and only allow certain usergroups to see that section.

princesspepper 09-10-2011 05:53 PM

I tried putting the username code in a php content type and that didn't parse. How would I go about doing this?

Lynne 09-10-2011 11:42 PM

Without seeing your exact code, I can't tell you what you did wrong. Can you please post it?

princesspepper 09-13-2011 11:44 AM

The code is what I posted originally. I used in in both a static HTML page, and a php page. Neither parsed.

I have managed to make my page now using the misc.php?do=page&page=MyPage

with custom_MyPage as a custom template :)


All times are GMT. The time now is 05:01 PM.

Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.

X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.00986 seconds
  • Memory Usage 1,715KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)bbcode_code_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (5)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.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/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • printthread_start
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete