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 09-20-2012, 04:34 AM
Edgespeeder06 Edgespeeder06 is offline
 
Join Date: Nov 2009
Posts: 98
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default Widget Visible for Logged Out Only

I'm having a hard time trying to get ad widgets to display in my CMS for logged out users only. What's the catch to it? My code to display to logged only doesn't seem to work in the cms widgets. anyone? Thanks

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

I figured out the code but it doesn't hide the widget header when I'm logged in just the internal code.....anyone?

Code:
if (vB::$vbulletin->userinfo['userid'] == 0)
$output = "This is some html for guests<br />\n";
Reply With Quote
  #2  
Old 09-20-2012, 10:22 AM
kh99 kh99 is offline
 
Join Date: Aug 2009
Location: Maine
Posts: 13,185
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

What you can do is this: when you configure your widget, near the bottom is a field for Template Name. It should say "vbcms_widget_execphp_page". Change that to something like "vbcms_widget_execphp_guests_only".

Then go to the Style Manager and (probably in your default style) edit the vbcms_widget_execphp_page template and copy the code. Then create a new template called vbcms_widget_execphp_guests_only and paste in the code, and add 'if' tags around it, like:

Code:
<vb:if condition="$bbuserinfo[userid] == 0">
// existing code here
</vb:if>
Reply With Quote
Благодарность от:
goxy63
  #3  
Old 09-20-2012, 11:36 AM
Edgespeeder06 Edgespeeder06 is offline
 
Join Date: Nov 2009
Posts: 98
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Perfect thank you. that worked flawlessly!
Reply With Quote
  #4  
Old 02-13-2013, 10:59 AM
goxy63 goxy63 is offline
 
Join Date: Oct 2008
Location: its like another planet:D
Posts: 657
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I cant make it work, that is it is showing only for not logged in users but nothing within widget tho, widget is collapsed, empty

Did same as mentioned above, only I am trying to place advertise there in a widget visible only for guests

My widget type: Static HTML
My widget code is:
Code:
<center><script type="text/javascript" src="http://www.adcash.com/script/java.php?option=rotateur&rotateur=123456"></script></center>
And yes I created new template placed same code there as in "vbcms_widget_execphp_page" and call it "vbcms_widget_execphp_guests_only" ...also I did change Template Name for widget to "vbcms_widget_execphp_guests_only"

Help pls
Thank you

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

Ohhh

Just edited new template "vbcms_widget_execphp_guests_only" placing there add code, and its working just fine

Thank you "kh99"
Reply With Quote
  #5  
Old 02-13-2013, 11:12 AM
kh99 kh99 is offline
 
Join Date: Aug 2009
Location: Maine
Posts: 13,185
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I created a static html widget with the content you posted and just used the existing template, and I get a blank widget, so I think the problem is that the code you posted isn't producing any output.

Also, the template for a static html widget is vbcms_widget_static_page (at least it seems to be for me), but the one you copied might be close enough to work.
Reply With Quote
  #6  
Old 02-13-2013, 11:29 AM
goxy63 goxy63 is offline
 
Join Date: Oct 2008
Location: its like another planet:D
Posts: 657
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Thanks "kh99" its working great, I already posted but my last post merged to first one, just forgot/did not know to
edit new template "vbcms_widget_execphp_guests_only" and to place add code there as well

Thank you very much, now will play with this as I got me lots of articles

Cheers
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 02:19 AM.


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.04309 seconds
  • Memory Usage 2,212KB
  • Queries Executed 13 (?)
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
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)navbar
  • (3)navbar_link
  • (120)option
  • (6)post_thanks_box
  • (1)post_thanks_box_bit
  • (6)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (1)post_thanks_postbit
  • (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_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
  • 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
  • fetch_musername
  • post_thanks_function_fetch_thanks_end
  • post_thanks_function_thanked_already_start
  • post_thanks_function_thanked_already_end
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • post_thanks_function_fetch_thanks_bit_start
  • post_thanks_function_show_thanks_date_start
  • post_thanks_function_show_thanks_date_end
  • post_thanks_function_fetch_thanks_bit_end
  • post_thanks_function_fetch_post_thanks_template_start
  • post_thanks_function_fetch_post_thanks_template_end
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete