Answers.Body: <p>That looks correct, though I have some suggestions for improvement:</p>
  
  <ul>
  <li>Your first step is "retrieve contribution from civicrm database".  The contribution is already going to be stored in $objectRef, so that should be unnecessary.</li>
  <li>If you want to avoid coding, you can probably accomplish this with the Drupal Rules and civicrm_entity module.</li>
  </ul>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2015-06-24T15:55:30.093Z
Answers.LastActivityDate: 2015-06-24T15:55:30.093Z
Answers.UserDisplayName: Jon G - Megaphone Tech
Body: <p>Drupal 7.37, CiviCRM 4.4.15</p>
  
  <p>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).  </p>
  
  <p>Would we use something like this:</p>
  
  <p>myhooks_civicrm_post($op, $objectName, $objectId, &amp;$objectRef) {</p>
  
  <pre><code>if ($op == 'create' &amp;&amp; $objectName == 'Contribution') {
     //retrieve contribution from civicrm database
     //retrieve tracker information from civicrm database
     //if tracker.appeal &gt; 0 
     //   retrieve node from drupal database
     //   update node in drupal database
  }
  </code></pre>
  
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2015-06-24T20:49:27.060Z
Comments.Text: 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?
Comments.UserDisplayName: Chris Burgess
Tags: <drupal><contributions>
Title: Correct means to update Drupal Node after user submits a donation
ThreadText: # Correct means to update Drupal Node after user submits a donation
  
  (Asked by: username_0 on 2015-06-24)
  
  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
  }
  
  **Tags:** drupal, contributions
  
  > **Comments:**
  > **username_1**: 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?  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_2 on 2015-06-24. Score: 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.
  
  
  ---
  
  