We build. You grow.

Get best community software here

Start a social network, a fan-site, an education project with oxwall - free opensource community software

Passing Custom Profile Field to Custom Script Module | Forum

Rob R
Rob R Sep 4 '14
I'd like to add, for example, a weather forecast widget on the dashboard.  The widget has pre-defined cities to select from.  I'd like to create a custom profile field of those pre-defined cities.  So when the member chooses their city, that field gets passed onto the custom text/html box and onto the widget script. 

Something like {custom_profile_1} that can be replaced into the widget code where "Los Angeles" would be.

Any suggestions greatly appreciated.
Rob R
Rob R Sep 8 '14
Hoping to get feedback on this.  Is this more involved than it sounds?  I thought it would just be a matter of calling the custom profile field variable in an includes php.  Just need some advice on where I can call that variable so it will have data in the custom script.
Rob R
Rob R Sep 8 '14
Ok I see where to find the custom profile field identifiers - in the ow_base_question table.  You can verify the field by looking at values entered by users in the ow_base_question_data table.

For me, the custom field I am trying to pass to a script is a field that asks for the members location, "field_ebb1ecdb744484835770d77f2c775383" ... yes, not the most intuitive identifier.

So let's say the user entered for this field the location of Los Angeles.  I want to pass $field_ebb1ecdb744484835770d77f2c775383 to a script in a custom HTML widget which contains a weather forecast widget script.

For sake of discussion, here is some example code I pulled from some weather website:


<a href="http://www.accuweather.com/...rrent-weather/347625" class="aw-widget-legal">
By accessing and/or using this code snippet, you agree to AccuWeather’s terms and conditions (in English) which can be found at http://www.accuweather.com/en/free-weather-widgets/terms and AccuWeather’s Privacy Statement (in English) which can be found at http://www.accuweather.com/en/privacy.
</a><div id="awtd1410214930912" class="aw-widget-36hour"  data-locationkey="347625" data-unit="f" data-language="en-us" data-useip="false" data-uid="awtd1410214930912" data-editlocation="false"></div><script type="text/javascript" src="http://oap.accuweather.com/launch.js"></script>


This code in particular:




Would be replaced with my custom profile field such that:


Yes, I would have to write some php that translates the member's selection into the corresponding widget location code.

This is just an example and I actually intend to do this for surf reports in which case, there may be 100s, not 1000s of possible choices.

Is this really that difficult to do?  I had this sort of widget running on a phpBB site running flawlessly.
Daisy Team
Daisy Oct 6 '14
Rob, you should create a small plugin which will add the profile question you need. Please download our 'Plugin Skeleton' plugin to see how to create and pass the profile questions data. Here is URL to the Store item: http://www.oxwall.org/store/item/695