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

Reply
 
Thread Tools Display Modes
  #1  
Old 08-20-2011, 01:06 AM
pjkcards pjkcards is offline
 
Join Date: Jul 2007
Posts: 299
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default 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.
Reply With Quote
  #2  
Old 08-20-2011, 12:23 PM
kh99 kh99 is offline
 
Join Date: Aug 2009
Location: Maine
Posts: 13,185
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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
Reply With Quote
  #3  
Old 08-20-2011, 06:18 PM
pjkcards pjkcards is offline
 
Join Date: Jul 2007
Posts: 299
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by kh99 View Post
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!
Reply With Quote
  #4  
Old 08-20-2011, 06:22 PM
kh99 kh99 is offline
 
Join Date: Aug 2009
Location: Maine
Posts: 13,185
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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.
Reply With Quote
  #5  
Old 11-30-2011, 08:18 PM
malmazan malmazan is offline
 
Join Date: Feb 2006
Posts: 63
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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?
Reply With Quote
  #6  
Old 11-30-2011, 09:21 PM
kh99 kh99 is offline
 
Join Date: Aug 2009
Location: Maine
Posts: 13,185
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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.
Reply With Quote
Reply


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 01:57 AM.


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.03760 seconds
  • Memory Usage 2,216KB
  • Queries Executed 11 (?)
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
  • (1)ad_showthread_firstpost
  • (1)ad_showthread_firstpost_sig
  • (1)ad_showthread_firstpost_start
  • (3)bbcode_code
  • (4)bbcode_php
  • (1)bbcode_quote
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)navbar
  • (3)navbar_link
  • (120)option
  • (6)post_thanks_box
  • (6)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (6)post_thanks_postbit_info
  • (6)postbit
  • (6)postbit_onlinestatus
  • (6)postbit_wrapper
  • (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_post_thanks.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
  • showthread_start
  • showthread_getinfo
  • forumjump
  • showthread_post_start
  • showthread_query_postids
  • 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