![]() |
Members only widget?
I've searched, seen a few questions that touch on the subject, but no answers.
How does one code a widget to be visible to members only? I have an HTML widget, but want it to be visible to members only... I take it this will now have to be PHP. Assistance would be greatly appreciated. |
If you want a widget where the html changes depending on whether or not the user is a guest, then you could create a php widget with code like this:
Code:
if (vB::$vbulletin->userinfo['userid'] == 0) and set the cache time to 0. If you want the entire widget to disappear for guests then you could change the "Template Name" field to a custom template, copy the vbcms_widget_execphp_page template contents to your custom template, and surround it with a conditional that checks for $bbuserinfo[userid] != 0. |
Hi sorry for reviving an old thread but I can't get this to work:
Code:
if (vB::$vbulletin->userinfo['userid'] == 0) |
I tried the code you posted and it works for me. The message gets displayed to members only, and for guests the widget is blank. If you want to post the exact code you tried we can look at that.
Edit: also, I might have been wrong when I said that you need to set the cache time to 0 - I think the widget is cached for each user. So you should try setting the cache time to 1 or more and see if that works. |
Thank you, the error message comes when I add a google adsense ad code into there. Is that not possible into php? How do I get around it so I can put an ad on the widget page visible to guest only?
Maybe something down the road for Vbulletin to build into their Ad management tool since they have it for the CMS yet. Thank you --------------- Added [DATE]1348144607[/DATE] at [TIME]1348144607[/TIME] --------------- Solution here for anyone who needs it: https://vborg.vbsupport.ru/showpost....52&postcount=2 Thanks again |
Quote:
|
All times are GMT. The time now is 11:00 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 | |
---|---|
|
|
![]() |
|
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|