saveEditTab

18 years 4 months ago #2187 by dhpollack
saveEditTab was created by dhpollack
Does saveEditTab save data into the #__comprofiler table or the #__comprofiler_plug_xxx table? I've been trying to save data into the #__comprofiler table, and haven't been successful. I've tried setting the $user->field to the value I want, and I've tried $postdata["field"] as well. The code I'm using is below. I'll attach the entire file if that'll help. Note that the exact same code produces the desired results for $loc and $loc when I use it in the getEditTab($tab, $user, $ui).

function saveEditTab($tab,$user,$ui,$postdata) {

$params = $this->params;
$args = array();
$lng = $params->get('geoLng', 'Text Parameter not set!');
$lat = $params->get('geoLat', 'Text Parameter not set!');
$args = $params->get('geoAddress','');
$args = $params->get('geoCity','');
$args = $params->get('geoState','');
$args = $params->get('geoCountry','');
$args = $params->get('geoPostcode','');

$userData["address"] = ($user->$args) ? $user->$args : "";
$userData["city"] = ($user->$args) ? $user->$args : "";
$userData["state"] = ($user->$args) ? $user->$args : "";
$userData["country"] = ($user->$args) ? $user->$args : "";
$userData["zipcode"] = ($user->$args) ? $user->$args : "";
$userData["lat"] = ($user->$lat) ? $user->$lat : "";
$userData["lng"] = ($user->$lng) ? $user->$lng : "";

$coords;

$loc = $this->checkLatLong($userData);

$user->$lat = $loc;
$user->$lng = $loc;

$postdata["$lng"] = $user->$lng;
$postdata["$lat"] = $user->$lat;





}

Attachment geocoder.php not found

Attachments:

Please Log in to join the conversation.

18 years 4 months ago #2256 by mikko
Replied by mikko on topic Re:saveEditTab
All data is saved in #__comprofiler table, unless the plugin uses it's own sql to do custom inserts.

Easiest way to save data in a custom way is by using the onBeforeUserUpdate and modufy teh row and rowExtras variables that are passed to CBs funcion that acutally modifys the values in the DB.

mikko

Please Log in to join the conversation.

18 years 4 months ago #2268 by dhpollack
Replied by dhpollack on topic Re:saveEditTab
First of, thank you, thank you, thank you, thank you!!! I knew it really wasn't that difficult, but for some reason i just couldn't wrap my head around it. I'm still having a slight problem though.

$params = $this->params;

That line is not working. It should return the parameters of the plug-in but it doesn't. Strangely, this does work for the tab that I make for the plug-in.

Please Log in to join the conversation.

18 years 4 months ago #2338 by mikko
Replied by mikko on topic Re:saveEditTab
can you post the code here?

Please Log in to join the conversation.

18 years 3 months ago #2467 by dhpollack
Replied by dhpollack on topic Re:saveEditTab
I actually fixed what I needed to do. I've got an alpha version of the component if you'd like to see it I'm attaching it to this message. Right now I'm having trouble creating a list field via the xml, but the actual program does work. To use this you must create some new fields for address/city/state/country/postcode or any combination of those. Then the component has parameters for entering the name of these fields. One thing to watch out for is that the geocoder uses two letter abbreviations for countries and the international geocoder is not nearly as good as the US one. Lastly, you'll have to update your profile and it should geocode you. Tell me what you think.

Attachment geocoder.zip not found

Attachments:

Please Log in to join the conversation.

18 years 3 months ago #2499 by PeterMixt
Replied by PeterMixt on topic Re:saveEditTab
Sweet stuff David... I've benn swamped with work $$$ (I'm not complaining) and my google/geo project got sidetracked. I love what I am seeing from you and will play with this - this week.

thanks for the code...

PeterMixt

PeterMixt

Please Log in to join the conversation.

Moderators: beatnantkrileon
Time to create page: 0.206 seconds