PDA

View Full Version : vBulletin CMS Widgets - Weather Channel widget that uses members zip code


benstillman
06-13-2010, 10:00 PM
This adds the Weather Channel widget to your CMS, pulling the weather from the user's zip code.


- Create a new style template titled "vbcms_widget_weather".
- Create a new profile field named "zip code". Take note of the profile field number.
- Insert the following into the new template, changing $bbuserinfo[fieldXX] to the correct field number ($bbuserinfo[field8] in my case):
<div class="cms_widget">
<div class="block">
<div class="cms_widget_header">
<h3>{vb:raw widget_title}</h3>
</div>
<div class="cms_widget_content">
<center>
<vb:if condition="is_member_of($bbuserinfo, 1)">
Registered members can see their local weather forcast here.
<br /><br />
<a href="{vb:raw vboptions.bburl}/register.php">Click here to register!</a>
<br /><br />

<vb:else />

<vb:if condition="$bbuserinfo[fieldXX] !=''">
<script src='http://voap.weather.com/weather/oap/{vb:raw bbuserinfo.fieldXX}?template=GENXV&par=3000000007&unit=0&key=twciweatherwidget'></script>

<vb:else />

Add your <A HREF="{vb:raw vboptions.bburl}">/profile.php?do=editprofile">Zip Code</A> to show weather forcast.

</vb:if>

</vb:if>

</center>

</div>
</div>
</div>
- Create a new widget with type "Static HTML".
- Title it "Weather" or whatever else you want.
- Save it.
- Configure the widget to use the "vbcms_widget_weather" template.
- Add the widget to your CMS where ever you like.


You can customize the Weather Channel widget including F/C, background image, etc: http://www.weather.com/services/oap/weather-widgets.html


EDIT: Some users are having a difficult time following my instructions. It makes sense to me, but I guess I'm the only one. Here's Octavius' version of the instructions:

In that code he posted you will see fieldXX and if you look a little further you'll see field8

Replace both fieldXX and field8 with the profile field number that you created for the zip code.

That's the fist part.

Second part, do what aenable did in his post.

3rd part, Take that whole code and put it inside the new vbcms_widget_weather template

Then create your static html widget and copy that same code into Configure.

If you have more than one forum skin, you'll have to create a vbcms_widget_weather for each template.

For instance, I have 11 skins so I had to make 11 new templates but configure the widget only one time.

sulasno
06-14-2010, 04:08 PM
is it possible to use another country?

benstillman
06-14-2010, 07:09 PM
is it possible to use another country?

Sure is.

For instance, here's Munich:
http://voap.weather.com/weather/oap/GMXX0087?template=GENXV&par=3000000007&unit=0&key=twciweatherwidget

Instead of a zip code, you need to go to www.weather.com and search for your city/country. It will return a URL like:
http://www.weather.com/weather/today/Munich+Germany+GMXX0087?x=0&y=0

GMXX0087 is the code you need to put in your user profile field which this widget is referencing. Probably not the easiest way to do this, but it works.

If you have a specific country in mind, I can see what I can do.

sulasno
06-15-2010, 03:45 AM
thanks for the tip

Sledgstone
06-25-2010, 11:19 PM
Thanks! I've been looking for this!

benstillman
07-06-2010, 04:32 PM
One star, but nobody has posted any negative comments for me to follow up on. Sweet.

kapii
07-13-2010, 08:27 AM
It might also help to give specific details on setting it up for those that are less knowledgeable about the new vB... To the average user, it's even confusing, and I've been using vB since 2008...

:confused:

TbChampions
07-13-2010, 06:31 PM
Hi Ben! This looks like a nice addition. Unfortunately, it's not working for me yet. I did everything per instructions, with the possible exception of this part:

- Configure the widget to use the "vbcms_widget_weather" template.

I don't know how/what you mean by the above, and this may be why it's not working for me yet.

Thanks!

Victoria

ozzy47
07-13-2010, 08:34 PM
I got it installed, voted 5 stars!!

mimi123
08-01-2010, 06:31 PM
tell me whats the point in creating a profile field for zip code when it doesn't even work? weather.com will give the html code to put in your weather configuration after you enter "your own" city. which will appear to all members in my site, if they wanna know their weather they have to enter their zip code in that "go" box. so whats the point for the profile field tell me

benstillman
08-05-2010, 05:43 PM
tell me whats the point in creating a profile field for zip code when it doesn't even work? weather.com will give the html code to put in your weather configuration after you enter "your own" city. which will appear to all members in my site, if they wanna know their weather they have to enter their zip code in that "go" box. so whats the point for the profile field tell me

No idea what you're talking about.

This passes your zip code to the url, so users with their zip code entered in the profile field will just see their weather without having to type in their zip code each time.

Try it, you'll see what I mean.

8thos
09-28-2010, 05:09 AM
*subs*

aenable
11-12-2010, 05:38 PM
FWIW, I had to change this line:
Add your <A HREF="{vb:raw vboptions.bburl}">$/profile.php?do=editprofile">Zip Code</A> to show weather forcast.


to this:
Add your <A HREF="{vb:raw vboptions.bburl}/profile.php?do=editprofile">Zip Code</A> to show weather forecast.


to fix the link in the widget when there is no zip code showing.

(VB4.0.7)

Thanks!

8thos
12-11-2010, 11:06 PM
Works great! Dude gave bad directions though.

OldSchoolDSL
12-12-2010, 06:57 AM
Works great! Dude gave bad directions though.

Found it a little hard to understand also.

Would you please be so kind as to maybe clear up the details?

8thos
12-12-2010, 08:13 PM
Found it a little hard to understand also.

Would you please be so kind as to maybe clear up the details?In that code he posted you will see fieldXX and if you look a little further you'll see field8

Replace both fieldXX and field8 with the profile field number that you created for the zip code.

That's the fist part.

Second part, do what aenable did in his post.

3rd part, Take that whole code and put it inside the new vbcms_widget_weather template

Then create your static html widget and copy that same code into Configure.

If you have more than one forum skin, you'll have to create a vbcms_widget_weather for each template.

For instance, I have 11 skins so I had to make 11 new templates but configure the widget only one time.

Richard Evans
12-15-2010, 06:23 PM
How to you add the profile field (Zip Code). I am unfamiliar with where that is.
thanks in advance

paulvev
12-15-2010, 06:53 PM
Agreed. I'm no newb, but this thread needs some serious step by step instructions or guidance.

nick_n_ii
12-24-2010, 12:52 AM
Installed setup but not working at all..

benstillman
01-05-2011, 02:03 PM
Agreed. I'm no newb, but this thread needs some serious step by step instructions or guidance.

The first post is nothing but step by step instructions. I'm not sure how to make it any clearer than that. Not trying to sound rude, but I really don't know what else to say.

benstillman
01-05-2011, 02:06 PM
How to you add the profile field (Zip Code). I am unfamiliar with where that is.
thanks in advance

admincp

User Profile Fields

Add profile field

http://yourwebsite.com/admincp/profilefield.php?do=add

benstillman
01-05-2011, 02:12 PM
FWIW, I had to change this line:
Add your <A HREF="{vb:raw vboptions.bburl}">$/profile.php?do=editprofile">Zip Code</A> to show weather forcast.


to this:
Add your <A HREF="{vb:raw vboptions.bburl}/profile.php?do=editprofile">Zip Code</A> to show weather forecast.


to fix the link in the widget when there is no zip code showing.

(VB4.0.7)

Thanks! Fixed. Thanks!

In that code he posted you will see fieldXX and if you look a little further you'll see field8

Replace both fieldXX and field8 with the profile field number that you created for the zip code.

That's the fist part.

Second part, do what aenable did in his post.

3rd part, Take that whole code and put it inside the new vbcms_widget_weather template

Then create your static html widget and copy that same code into Configure.

If you have more than one forum skin, you'll have to create a vbcms_widget_weather for each template.

For instance, I have 11 skins so I had to make 11 new templates but configure the widget only one time. Added your instructions to the original post.

ThisIrksMe
01-07-2011, 12:23 AM
Does this not work for vB4.1PL2?

kenmoresp
01-13-2011, 01:55 AM
Question,
Will the work for 3.8.x ???

Boofo
01-13-2011, 05:14 AM
You might want to add a TXT file to the first post with the instructions in it. That way they will have it in case they need to re-install it, for whatever reason, sometime in the future.

expediteinsight
01-30-2011, 04:11 AM
<span style="text-decoration: line-through">Sorry, I'm a little confused on how to implement this.

I have added the zip code field, and modified the code with the correct field number. I also created a new style named vbcms_widget_weather and created the new widget.

I am stuck on two things: 1) Insert the following into the new template, and 2)Configure the widget to use the "vbcms_widget_weather" template.

Where do you insert the code into the new template? I am using VB 4, and it looks like the "main css" area is no longer supported. Do I need to upload an XML file?

And then after that is done, how do I link the style with the widget?</span>

Edit:
I figured it out. I was going to delete this, but in case anyone has the same problem, I will explain what I did.

I was confusing "new style" with "new template" for an existing style. If you go to Style Manager > Drop-down menu for your current style > Add new template, you will be able to add vbcms_widget_weather and paste the code into the large text box.

Then, when you create the new widget, click Configure. Once again paste the code into this text box (I'm not sure why it needs to be in both places, but I just started using vbulletin today so I am very new). Then below the Static html box, there is a "template name" field. Paste vbcms_widget_weather into this field.

benstillman
02-08-2011, 02:51 PM
Does this not work for vB4.1PL2?

Works on my 4.1.1 dev site.

rbc1225
04-20-2011, 12:50 AM
Sorry, I'm a little confused on how to implement this.

I have added the zip code field, and modified the code with the correct field number. I also created a new style named vbcms_widget_weather and created the new widget.

I am stuck on two things: 1) Insert the following into the new template, and 2)Configure the widget to use the "vbcms_widget_weather" template.

Where do you insert the code into the new template? I am using VB 4, and it looks like the "main css" area is no longer supported. Do I need to upload an XML file?

And then after that is done, how do I link the style with the widget?

Edit:
I figured it out. I was going to delete this, but in case anyone has the same problem, I will explain what I did.

I was confusing "new style" with "new template" for an existing style. If you go to Style Manager > Drop-down menu for your current style > Add new template, you will be able to add vbcms_widget_weather and paste the code into the large text box.

Then, when you create the new widget, click Configure. Once again paste the code into this text box (I'm not sure why it needs to be in both places, but I just started using vbulletin today so I am very new). Then below the Static html box, there is a "template name" field. Paste vbcms_widget_weather into this field.

That totally cleared any problem I was having. Thanks a lot.

EdQ
07-09-2011, 04:48 PM
Edit:
I figured it out. I was going to delete this, but in case anyone has the same problem, I will explain what I did.

I was confusing "new style" with "new template" for an existing style. If you go to Style Manager > Drop-down menu for your current style > Add new template, you will be able to add vbcms_widget_weather and paste the code into the large text box.

Then, when you create the new widget, click Configure. Once again paste the code into this text box (I'm not sure why it needs to be in both places, but I just started using vbulletin today so I am very new). Then below the Static html box, there is a "template name" field. Paste vbcms_widget_weather into this field.

You don't need it in both places.

I copied this into the widget which I think just calls out the template.

<div class="cms_widget">
<div class="block">
<div class="cms_widget_header">
<h3>{vb:raw widget_title}</h3>
</div>
<div class="cms_widget_content">



The I created the template as written, but I did it in my parent style so I didn't have to create it in all my styles.

It works. Thanks.

jmp51483
09-04-2011, 03:02 AM
works well here thanks!

Krusty1231
09-04-2011, 07:18 AM
Works great on VBadvanced as well.

Thanks for this!

mradlin
09-05-2015, 07:21 AM
Is anyone having a problem getting the widget to show with Google Chrome? It works for IE and Firefox, just not Chrome.