I need somebody experienced with vBulletin and Google Maps API to write a custom mod compatible with vBulletin 3.8.x that will:
1) add custom fields to the new/edit thread posting form.
2) take input (a Google Maps url) from one of these custom fields and grab (grep? regex?) certain elements (coordinates) to be made available as variables which are saved to the vBulletin database and displayed in the first post of a new thread
3) use the same variables to get geocode information from Google and save fields from the Google Maps API JSON results (or XML results if you prefer) to the database and made available to be displayed in the first post. I think a separate db table for the data from item #1 and the returned JSON fields are ideal but am open to alternate suggestions.
Requirements
- Some fields will be required and some will not. Failing to submit appropriate data in a required field returns error indicating the problem.
- input of Google Maps url in one custom field is verified to be a Google url (including various international domains)
- All data submitted through custom fields are run through vBulletin’s form/input cleaning as well as protections from SQl injections, CSRF, other common attacks and clean out any submitted HTML
- Edit of thread posts containing url and other information from the custom fields will automatically display what is currently saved to the database and allow for edit/replacement according to vbulletin permissions regarding editing privileges. Change to Google Maps url in custom field will initiate reprocessing of grep/regex and related variables/data replaced in database (it would be a nice extra to have it prompt before replacing this data)
-Not all forums/new threads will use the custom fields. Make sure there are no errors if no data is submitted in the custom fields (these fields will likely not be shown in certain areas of the site).
-I have no problem with using an existing vBulletin hack such as http://www.vbulletin.org/forum/showthread.php?t=128587 as long as it is fixed to work with v3.8. I am also open to other vB hacks you may know that may make coding easier.
At the end of the project I expect the mod and all the changes with documentation (full install instructions) to be zipped and sent to me.
- – - – - – - – - – - – - – - – - – - – - – - – - – - – - – - – -
Sample of how this might work
User goes to do=newthread where custom field submission of this Google Map URL is entered:
http://maps.google.com/maps?f=q&source=s_q&hl=en&geocode=&q&ie=UTF8&layer=c&cbll=30.272735,-97.741076&panoid=CGDtk5FW3PDHGPuW_Vnh9g&cbp=12,13.06,,0,-2.17&ll=30.272587,-97.741123&spn=0.005597,0.00751&z=17&iwloc=A
The code verifies a clean Google Maps url was submitted and will grab this information from the submitted url:
&cbp=12,13.06,,0,-2.17
&ll=30.272587,-97.741123
This information will then, for example, be able to be inserted into the following HTML and displayed on the first post of the new thread
<iframe width=”425″ height=”240″ frameborder=”0″ scrolling=”no” marginheight=”0″ marginwidth=”0″ src=”http://maps.google.com/maps/sv?cbp=***cbp goes here***&cbll=***ll goes here***&panoid=&v=1&hl=en&gl=us”></iframe>
The &ll coordinates will also be submitted through the Google Map API for reverse geocoding (http://code.google.com/apis/maps/documentation/geocoding/#ReverseGeocoding) to receive and store the following JSON results in the database: id, address. CountryNameCode. CountryName. AdministrativeAreaName. LocalityName. ThoroughfareName. PostalCodeNumber and Accuracy.
If somebody goes to edit the post the custom fields and default thread fields will be visible and contain the information from the database. Changes to the post will result in the Google Map API information to be updated and saved back to the database.
Links that or may not be useful
Add custom fields to new threads
http://www.vbulletin.org/forum/showthread.php?t=114249
Validate fields or extract information using regular expressions
http://www.vbulletin.org/forum/showthread.php?t=215466
vBulletin Custom DataManagers (might be useful)
http://www.vbulletin.org/forum/showthread.php?t=119376
vBulletin Docs
http://www.vbulletin.com/docs/html/
vBulletin API Basics
http://www.vbulletin.org/forum/showthread.php?t=98009
Implementing CSRF Protection in modifications
http://www.vbulletin.org/forum/showthread.php?t=177013
Google Maps API
http://code.google.com/apis/maps/doc…ion/index.html
Google API – Geocoding
http://code.google.com/apis/maps/doc…ion/geocoding/