vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB4 General Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=251)
-   -   Display a forum block only to certain usergroups (https://vborg.vbsupport.ru/showthread.php?t=268798)

pjkcards 08-20-2011 01:06 AM

Display a forum block only to certain usergroups
 
I'm having a hard time doing this.

I've used an HTML content type with this, and no luck:
Code:

<vb:if condition="is_member_of($bbuserinfo, 1, 2, 3, 4, 15, 17)">
text
</vb:if>

And I've also tried this with no luck (want to display to everyone but 16):
Code:

<vb:if condition="!is_member_of($bbuserinfo, 16)">
text
</vb:if>

Can I modify permissions anywhere else for forum blocks since this isn't working for some reason? Thanks.

kh99 08-20-2011 12:23 PM

You can't use <vb:if... in html, only in a template. You could put your html in a template, make your widget PHP Direct Execution and use:

PHP Code:

$templater vB_Template::create('my_template');
$output $templater->render(); 


or you could use this code without making a template

PHP Code:

if (!is_member_of(vB::$vbulletin->userinfo16))
{
    
$output "<div> This is my html
blah blah
"
;


or you could put your html in a template and

pjkcards 08-20-2011 06:18 PM

Quote:

Originally Posted by kh99 (Post 2235728)
You can't use <vb:if... in html, only in a template. You could put your html in a template, make your widget PHP Direct Execution and use:

PHP Code:

$templater vB_Template::create('my_template');
$output $templater->render(); 


or you could use this code without making a template

PHP Code:

if (!is_member_of(vB::$vbulletin->userinfo16))
{
    
$output "<div> This is my html
blah blah
"
;


or you could put your html in a template and

Edit: I got it to work after playing with it a bit. It blocks all the content within the block, but it doesn't hide the block itself. How do I have it hide the block itself?

Thanks!

kh99 08-20-2011 06:22 PM

Oops...yeah, I'm not sure what problem you're having exactly, but I just realized that it won't work like that because of the caching. I'm not sure if there's a way to write a PHP type block that doesn't cache. I'll look in to it...

--------------- Added [DATE]1313869007[/DATE] at [TIME]1313869007[/TIME] ---------------

OK - should have thought of this before, sorry. Anyway, go back to using a static html widget. Copy the contents of the template vbcms_widget_static_page and create a new widget with the same contents but surround it with the 'if' tags, like

Code:

<vb:if condition="!is_member_of($bbuserinfo, 16)">
<div class="cms_widget">
        <div class="block">
                <div class="cms_widget_header">
                <h3><img src="{vb:stylevar imgdir_siteicons}/html.png" alt="" /> {vb:raw widget_title}</h3>
                </div>
                <div class="cms_widget_content_restore_widget_content">
                {vb:raw static_html}
                </div>
        </div>
</div>
</vb:if>


Save it with some new name, then configure your widget and put that template in as the template name and your html in the html box.

malmazan 11-30-2011 08:18 PM

Would it be possible to have a Latest Threads forum block where a usergroup was shown latest threads for some forums and another usergroup was shown latest threads for other forums?

kh99 11-30-2011 09:21 PM

You would need code of some sort to make that work. I just reread this thread and realized that the original post asked about forum blocks and I was thinking widgets for some reason, so pjkcards, if you read this, sorry about that.


All times are GMT. The time now is 02:47 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.01078 seconds
  • Memory Usage 1,735KB
  • 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
  • (3)bbcode_code_printable
  • (4)bbcode_php_printable
  • (1)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (6)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