vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB4 Programming Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=252)
-   -   Widget Visible for Logged Out Only (https://vborg.vbsupport.ru/showthread.php?t=288057)

Edgespeeder06 09-20-2012 04:34 AM

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";


kh99 09-20-2012 10:22 AM

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>


Edgespeeder06 09-20-2012 11:36 AM

Perfect thank you. that worked flawlessly! :)

goxy63 02-13-2013 10:59 AM

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 :D

Thank you "kh99"

kh99 02-13-2013 11:12 AM

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.

goxy63 02-13-2013 11:29 AM

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


All times are GMT. The time now is 02:14 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.00990 seconds
  • Memory Usage 1,722KB
  • 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
  • (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