Drupal 7.37, CiviCRM 4.4.15

We are collecting tracking information when a user makes a contribution associated with child sponsorship (using URL parameters, custom fields, and a profile assigned to the contribution form). The tracking information included the id of the Drupal Node that needs to updated. We need to change the Sponsored field, Boolean value, to true after the payment has been processed successfully (credit card or ACH).

Would we use something like this:

myhooks_civicrm_post($op, $objectName, $objectId, &$objectRef) {

if ($op == 'create' && $objectName == 'Contribution') {
   //retrieve contribution from civicrm database
   //retrieve tracker information from civicrm database
   //if tracker.appeal > 0 
   //   retrieve node from drupal database
   //   update node in drupal database
  • If your contribution data includes the node id, you might be able to deliver this simply by using a Drupal View exposed on the node URL which shows whether the item has been sponsored? Commented Jun 24, 2015 at 20:49

1 Answer 1


That looks correct, though I have some suggestions for improvement:

  • Your first step is "retrieve contribution from civicrm database". The contribution is already going to be stored in $objectRef, so that should be unnecessary.
  • If you want to avoid coding, you can probably accomplish this with the Drupal Rules and civicrm_entity module.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.