PDA

View Full Version : Widget Visible for Logged Out Only


Edgespeeder06
09-20-2012, 04:34 AM
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 1348121191 at 1348121191 ---------------

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

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:


<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:
<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 1360757460 at 1360757460 ---------------

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