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

Reply
 
Thread Tools Display Modes
  #1  
Old 10-15-2012, 01:55 PM
Skivey Skivey is offline
 
Join Date: Jan 2008
Posts: 162
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default hide a block from membergroup

I have an "advert" block that I want to hide from paid members. Is there a simple way to do this?

http://forum.rsclassics360.co.uk/forum.php

Thanks

Matt
Reply With Quote
  #2  
Old 10-16-2012, 06:55 PM
Skivey Skivey is offline
 
Join Date: Jan 2008
Posts: 162
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

anyone?!

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

i tried doing this within the block.... dont work...

<if condition="$post['usergroupid'] != 24">
GOOGLE ADSENSE HERE
</if>
Reply With Quote
  #3  
Old 10-17-2012, 01:43 PM
qpurser qpurser is offline
 
Join Date: Jul 2011
Posts: 275
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I am not a pro in coding but did something similar. Not exactly the same what you are looking for but it might help to figure it out.
I didn't wanted to hide a block but display a message instead in that block to animate the unregistered/visitors (usergroupid 1) to register.

my code:
Code:
<vb:if condition="is_member_of($bbuserinfo, 1)">
Only Registered/Logged in users can view this section
<vb:else />
**** add here the contents you want to display and remember to add "</vb:if>" at the end of the contens you display****
by doing this everybody not belonging to usergroupid 1 will see the contents of the block
Reply With Quote
  #4  
Old 10-17-2012, 03:26 PM
Skivey Skivey is offline
 
Join Date: Jan 2008
Posts: 162
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

hmm that dont seem to work, is this in HTML, or PHP?

Mine is in HTML and its a adwords script within... i dunno its quite frustrating.

Thanks for the help
Reply With Quote
  #5  
Old 10-17-2012, 03:55 PM
Lynne's Avatar
Lynne Lynne is offline
 
Join Date: Sep 2004
Location: California/Idaho
Posts: 41,180
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

What *exactly* did you try and where, Skivey? We need the exact code and the template name.
Reply With Quote
  #6  
Old 10-17-2012, 05:22 PM
Skivey Skivey is offline
 
Join Date: Jan 2008
Posts: 162
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

hi lynne

Im using my google adsense code and putting it in the HTML block

I only want 'registered' members to see this block as my gold members have paid to remove adverts. Ive managed to do this for all of my forum except this.

I used the above code and put the google code in between it

If there isnt an easy way to do this, then ill just have to remove the block and put more adverts elsewhere... just would be good for the way the forum is laid out.

http://forum.rsclassics360.co.uk - its the advert on the left hand side block 'Advert'

Regards

Matt

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

oh and template is darkvision

Its quite editable

I was hoping each block may have an 'id' so that i can put something in the blocks template?

Thanks

Matt
Reply With Quote
  #7  
Old 10-17-2012, 06:00 PM
Lynne's Avatar
Lynne Lynne is offline
 
Join Date: Sep 2004
Location: California/Idaho
Posts: 41,180
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

So is this an html block? Or a PHP block or what? You cannot use template code in a block - it is for templates only. If you want block code to not show to a usergroup, you would need to use a PHP block and use PHP code like:

PHP Code:
if (is_member_of(vB::$vbulletin->userinfo1)) {
$my_output "html code here";
} else {
$my_output "other html code here";
}
return 
$my_output
Reply With Quote
  #8  
Old 10-17-2012, 07:41 PM
Skivey Skivey is offline
 
Join Date: Jan 2008
Posts: 162
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

So I have this in a PHP block but its showing not even a block for any membergroup. The idea is it only shows to normal registered members.

The code I put in was in a normal HTML block, but I understand it has to be in a php block now.

Here is what I tried... but nothing yet

PHP Code:
if+(is_member_of(vB::$vbulletin->userinfo,+2))+{
$my_output+=+"<script type="text/javascript"><!--
google_ad_client = "
ca-pub-2764312150803413";
/* sideblock */
google_ad_slot = "
1598615235";
google_ad_width = 250;
google_ad_height = 250;
//-->
</script>
<script type="
text/javascript"
src="
http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script>";
}+else+{
$my_output+=+"";
}
return+
$my_output
--------------- Added [DATE]1350506546[/DATE] at [TIME]1350506546[/TIME] ---------------

dunno why there are +'s there.. tey are spaces normally

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

its the speech brackets isnt it... think it messes it up....
Reply With Quote
  #9  
Old 10-17-2012, 09:16 PM
Lynne's Avatar
Lynne Lynne is offline
 
Join Date: Sep 2004
Location: California/Idaho
Posts: 41,180
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Use single quotes around the $my_output variable stuff (leave the double-quotes for the stuff inside).
Reply With Quote
  #10  
Old 10-18-2012, 05:25 AM
Skivey Skivey is offline
 
Join Date: Jan 2008
Posts: 162
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

its bizarre, its still showing nothing.

Block is enabled, and the script is below.

Im thinking im gonna put the adverts somewhere else.

HTML Code:
if+(is_member_of(vB::$vbulletin->userinfo,+2))+{
$my_output+=+'<script type="text/javascript"><!--
google_ad_client = "ca-pub-2764312150803413";
/* sideblock */
google_ad_slot = "1598615235";
google_ad_width = 250;
google_ad_height = 250;
//-->
</script>
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script>';
}+else+{
$my_output+=+'GOLD MEMBER';
}
return+$my_output;
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 10:50 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.04359 seconds
  • Memory Usage 2,275KB
  • Queries Executed 14 (?)
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
  • (1)bbcode_code
  • (1)bbcode_html
  • (2)bbcode_php
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)navbar
  • (3)navbar_link
  • (120)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (1)pagenav_pagelink
  • (10)post_thanks_box
  • (10)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (10)post_thanks_postbit_info
  • (10)postbit
  • (10)postbit_onlinestatus
  • (10)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
  • pagenav_page
  • pagenav_complete
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete