Connect module: updating existing participants

The folks at Make Poverty History wanted to make sure they had good data about their participant records, and so asked if we could make the connect module update information about existing participants.

The modular nature of connect made this relatively straightforward. The new connect action "Participant update" was added, which requires admins to define a unique identifier that it will use to match new form submissions to existing participant records. Thus, when a form is filled out and submitted, the new data overwrites the old.

This did mean a few changes that were a little more far-reaching than just adding a new function and declaring it using hook_connect(), however: the unique_identifier setting in "Participant update" is basically identical to the voteonce_identifier used by the "One vote one person" function, and to avoid redundancy, was renamed there. (This update is applied to extant actions by running update.php). I also had to add a new "child_build" hook that fires just before the child node is saved: this allows the new feature to set the nid and vid so that the existing node is properly referenced. And then the existing functions had to be revised respect the 'update' $op in hook_nodeapi, because for the first time we want to handle child node updates.

Conveniently the separation of 'update' and 'insert' $op values means that functions that take significant action (such as send email or faxes) can be configured to do so only on insert, and still allow participants to update their records without risk of firing off unnecessary events.

Currently these changes are available in the CVS version of the module. I expect to roll a new release once I have cleaned them up somewhat.

This project underscores for me a significant weakness of the connect module that should be relatively easy to address: it does not treat participants well as entities. Allowing an action to recognize pre-existing contacts and deal with them does, however, lay some groundwork to making this information available across actions for more flexibility and power. Perhaps this will be the next step for connect?


Section: 


Topic: 


Code: 


Add new comment

CAPTCHA
This question is for testing whether you are a human visitor and to prevent automated spam submissions.
2 + 3 =
Solve this simple math problem and enter the result. E.g. for 1+3, enter 4.
By submitting this form, you accept the Mollom privacy policy.