![]() |
|
#1
|
|||
|
|||
|
This is how I created a small window that shows a little weather info localized either for the user (if the user provided his/her zipcode) or for a pre-defined area if the user didn't provide his/her zipcode or isn't logged-in/registered.
vB version: 3.5.x, 3.6.x, 3.7.x vBa version: 2.x, 3.x Not guaranteed to work in other versions, however, reports have it that it works on vB 3.7.3 & vBa 3.1. 1. Create a custom user profile field: Admin CP -> User Profile Fields -> Add New User Profile field Profile Field Type: single-line text box Title: ZIP code Description: Enter your ZIP code. Some features on this website will be customized to your location (for example Weather Info). This information is kept private and other visitors cannot see it. Max length of allowed user input: 5 Private Field: Yes Field Searchable on Members List: No Show on Members List: No Regular Expression: "[0-9]" (dont enter the quotes) Which page displays this option?: Edit Profile IMPORTANT: Once you save the profile field and you're taken to the list of your profile fields, make a note of it's id number. Look to the right of it, it will say "field" and then a number, in my case it's "field7" This number is important, make a note of it, we'll use it later. 2. Create a template module: Admin CP -> vBa CMPS -> Add Module -> Template Fill out the fields to suit your taste. Template to include: adv_portal_weather (or whatever you like) Style: remember to pick one! Use Module Shell Template: Yes Template content: (WILL BE MODIFIED IN THE NEXT STEP) Code:
<tr> <td class="alt2" align="center"> <if condition="$bbuserinfo[FIELDX] == '' "> Weather information for X__________X:<br> <script src="http://netwx.accuweather.com/netweatherV2.asp?zipcode=DEFAULT_ZIP_HERE&lang=eng&size=5&metric=0"></script><br><br> <if condition="$bbuserinfo[userid] > '0' "> Would you like to see a weather info for your location?<br> <br> Click <a href="$vboptions[bburl]/profile.php?do=editprofile">here</a> and enter your zipcode into your profile. <br> <br> Every time you come back to our website your local weather will be displayed. </if> <if condition="$bbuserinfo[userid] == '0'"> Would you like to see weather info for your location?<br> <br> Please <a href="$vboptions[bburl]/register.php?">register</a> with our website and remember to fill in your zipcode.<br> <br> Every time you come back to our website your local weather will be displayed. </if> <else /> <script src="http://netwx.accuweather.com/netweatherV2.asp?zipcode=$bbuserinfo[FIELDX]&lang=eng&size=5&metric=0"></script> </if> </td> </tr> - Replace the X__________X with the name of your default location. (which user will see if they do not provide their zip or if they are not logged in) - Replace the DEFAULT_ZIP_HERE with the actual zipcode for your default location. Enter just 5 digits without any quotes. X______X and DEFAULT_ZIP_HERE should match each other, duhh ;-) - In both instances of [FIELDX] replace the X with the actual number I asked you to make a note of earlier. It should for example look like this : [field7] or [field1] END OF NECCESSARY MODIFICATION OPTIONAL MODIFICATION: You can change type of the weather block info by changing the parameter "size=5" in each of the lines that start with Code:
<script scr=" ...... > END OF OPTIONAL MODIFICATON That's it. If you followed the instructions to the T it should work on your website. Remember, the module has to be active and you may have to edit the page you want it to display on and enable it there (put a checkmark next to it in Admip CP -> vBa CMPS -> Edit Page. You can see it working here: www.TeamMR.com (left column, very bottom) Enjoy! Screenshots sizes 1 - 5 of unregistered users: Last edited by theczech; 09-23-2008 at 10:34 AM. |
|
#2
|
|||
|
|||
|
Post reserved for future use.
Screenshots: size 6 and size 5 of a logged-in user Last edited by theczech; 01-15-2007 at 07:22 PM. |
|
#3
|
|||
|
|||
|
You might want to double check your templet code. I get html code when I use it.
It also doesn't work for me. I also use Field7 and even though it is already populated I still get the message that I need to edit it. The other modification that you post this link in worked just fine for me but I wanted to alter the width so I tried this. I will be going back to the other one until this one is corrected. THanks! |
|
#4
|
|||
|
|||
|
Quote:
I think I see the problem. Code corrected, please, try again! Thanks! Last edited by theczech; 01-28-2007 at 10:31 AM. |
|
#5
|
|||
|
|||
|
Quote:
Code:
<tr> <td class="alt2" align="center"> <if condition="$bbuserinfo[field7] == '' "> Weather information for Clemson, SC:<br> <script src="http://netwx.accuweather.com/netweatherV2.asp?zipcode=29632&lang=eng&size=5&metric=0"></script><br><br> <if condition="$bbuserinfo[userid] > '0' "> Would you like to see a weather info for your location?<br> <br> Click <a href="$vboptions[bburl]/profile.php?do=editprofile">here</a> and enter your zipcode into your profile. <br> <br> Every time you come back to our website your local weather will be displayed. </if> <if condition="$bbuserinfo[userid] == '0'"> Would you like to see weather info for your location?<br> <br> Please <a href="$vboptions[bburl]/register.php?">register</a> with our website and remember to fill in your zipcode.<br> <br> Every time you come back to our website your local weather will be displayed. </if> <else /> <script src="http://netwx.accuweather.com/netweatherV2.asp?zipcode=$bbuserinfo[field7]&lang=eng&size=5&metric=0"></script"> </if> </td> </tr> |
|
#6
|
|||
|
|||
|
I don't see anything wrong with this code and I have no idea why it should affect your footer etc.
Can you give me a link to the page you're trying it on? What version of vB are you running? |
|
#7
|
|||
|
|||
|
Getting the same thing here theczech - the default zip code weather is being displayed regardless of what's entered in the users profile.
Using 3.6.4 and 2.2.1 Props for a great looking module however..would like to see this get fixed! |
|
#8
|
|||
|
|||
|
Quote:
Sorry, I wish I could help you more. Send me a PM if you're willing to give me an access to your admin CP, then I'll be able to help you with your 3.6.4 version. |
|
#9
|
|||
|
|||
|
I found what the problem was..it's an extra " in your code:
Remove the red " and all is good: Code:
<script src="http://netwx.accuweather.com/netweatherV2.asp?zipcode=$bbuserinfo[FIELDX]&lang=eng&size=5&metric=0"></script"> |
|
#10
|
|||
|
|||
|
Thanks!!!!
Code fixed now and all should be working well ... appreciate your hawk eye! |
|
#11
|
||||
|
||||
|
is there a version for us uk users??? we dont have zip codes but post codes
|
|
#12
|
|||
|
|||
|
Quote:
I'm sure you can figure out how to rename ZIPcode to Post code, how to find some uk weather website the provides with weather blogs based on postcodes, and how to replace the appropriate code ... you seem like a smart cookie ...
|
|
#13
|
|||
|
|||
|
I'm still having the same problem that John had. No matter what I enter into my zip code in my user profile, it acts like there is no zip code entered into my profile. No weather data is showing up.
Any update to this? Using 3.63 and 2.2.1 Last edited by Squintz; 03-14-2007 at 03:25 PM. |
|
#14
|
|||
|
|||
|
Quote:
What I can guarantee is that is works on 3.5 as that's what we have at www.TeamMR.com and as you see works well there. I'm sorry I can't be help you. |
|
#15
|
|||
|
|||
|
Works GREAT on our page so far.
Last edited by mamasnbabies; 03-21-2007 at 03:18 PM. |
|
#16
|
|||
|
|||
|
This is awesome !
I just installed and working with 3.6.4!! (had the same issue as above but got it resolved) Also, not everyone goes to the cmps page of my site. Most have a saved link directly to the forums. I have a column on the left on the main forums page and I wuld like to stick this weather information in there as well. Any tips / advice? Thanks, Last edited by javo; 04-26-2007 at 04:56 PM. |
|
#17
|
|||
|
|||
|
Quote:
|
|
#18
|
|||
|
|||
|
The site is www.mxcrazy.com
The direct link to the forums is www.mxcrazy.com/forums I have the left column hidden right now. I was just looking for generic code that I can put in the column or directly under the Navbar. It works great on the CMPS.. When I paste the same code inside the forums I get the issue where it uses the default location rather than whats defined in the profile field. |
|
#19
|
|||
|
|||
|
The same code should work anywhere within vbulletin website. It's nothing limited to just vba, it's a straight up html and it uses vbulletin variables. I really wish I had the time to experiment with it in our forums, but I have a baby on a way that should be here any hour now so I'm quite busy, I hope you understand ...
|
|
#20
|
|||
|
|||
|
I understand..
Hopefully theres another guru out there that can help... Grats on the little one! |
![]() |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Local music community | jaffa | Show off your vBadvanced! | 0 | 06-15-2006 11:45 AM |
| Weather Channel - Weather Module | boo | Add-On Modules & Modifications | 29 | 09-24-2005 12:24 PM |