The Arcive of Official vBulletin Modifications Site.It is not a VB3 engine, just a parsed copy! |
|
#1
|
|||
|
|||
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. |
#2
|
|||
|
|||
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) $output = "This is some html for guests<br />\n"; else $output = "This is some html for members<br />\n"; 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. |
#3
|
|||
|
|||
Hi sorry for reviving an old thread but I can't get this to work:
Code:
if (vB::$vbulletin->userinfo['userid'] == 0) $output = "<br />\n"; else $output = "Advertise with NJStangers Today!<br />\n"; |
#4
|
|||
|
|||
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. |
#5
|
|||
|
|||
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 |
#6
|
|||
|
|||
I'd have to see exactly what you're trying to do. It should be possible to do almost anything you want using a php widget, so it could just be a syntax error that can be easily fixed.
|
Thread Tools | |
Display Modes | |
|
|
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
More Information | |
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|