Need help finding the function that is being called by a module when a node is saved

Events happening in the community are now at Drupal community events on www.drupal.org.
aprice42's picture

Hello,

I am using the geocode module to add geodata to already existing location nodes on our site. To speed up the process of geocoding 3000+ nodes, I have enlisted the help of views bulk operations.

The idea is simple, geocode provides a cck field that can geo data based on a cck address field. All you have to do is edit and save the node and magically that node now has geo coordinates. Since VBO can save batches of nodes out of the box, I thought, that will be perfect, just select all 3000+ nodes and batch save them all in one go.

The problem is, that for some reason performing a bulk "save node" with VBO not only doesn't save the node with the geodata, it actually removes geodata if the node was already geocoded, d-oh!

I posted a support request on the VBO project page explaining my situation, and it was suggested that if I could find the function that does the geocoding when the node is saved, I could use VBO to call that function directly.

Unfortunately, I don't speak module very well, and I am having difficulty finding the function I need... I have looked through the geocode module code for hook_nodeapi, which I understand to be the function that would be called, but cannot find one...

is anyone out there able to take a quick look at the code and suggest some ideas?

here is what the module looks like: http://pastebin.com/XZtpzTgp
and the helper geocode_widget module: http://pastebin.com/cz1YVpsg
and the geocode include file: http://pastebin.com/4bq9m93x

There are a few other include files too, not sure if there is a way to get a all-in-one look at the order in which all includes etc... are called, and then compile that into one big php script to run with VBO?

Any help here would be greatly appreciated...

thanks,
Andy :)

Comments

drupal_execute

marcp's picture

From the Geocode project page, it sounds like there's a CCK widget that does the population of your geo fields. Since that's the case, you might want to try to drupal_execute() your node form. A search on drupal.org should give you some nice sample code to look at.

And, hopefully, someone will chime in on your issue in the Geocode queue.

run drupal_execute with vbo?

aprice42's picture

thank you marcp :) that seems like a great solution, might be a bit beyond my skills, but I would love to figure this out...

I tried to integrate drupal_execute with vbo by executing an arbitrary php script. In looking at drupal_execute I see I can pass variables to it drupal_execute($form_id, &$form_state).

With VBO I have access to the &$object and $context variables.

The form id for the form I want to submit is location_node_form, so i tried.
drupal_execute('location_node_form', &$form_state);

that didn't do anything, I figured it couldn't be that easy...
I also tried injecting the &$object and $context variables, but couldn't get that to work either...

Any ideas what else I can maybe with those variables?

Portland (Oregon)

Group notifications

This group offers an RSS feed. Or subscribe to these personalized, sitewide feeds:

Hot content this week