Answers.Body: <p>You can use hook_civicrm_post hook which gets called every time a core object is written to db. Detailed description can be found here: <a href="https://docs.civicrm.org/dev/en/latest/hooks/hook_civicrm_post/" rel="nofollow noreferrer">https://docs.civicrm.org/dev/en/latest/hooks/hook_civicrm_post/</a></p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2018-01-03T22:42:47.477Z
Answers.LastActivityDate: 2018-01-03T22:42:47.477Z
Answers.UserDisplayName: Hassan Farooq
Body: <p>In Drupal, I'm using <a href="https://docs.civicrm.org/dev/en/master/hooks/hook_civicrm_postSave_table_name/" rel="nofollow noreferrer">hook_civicrm_postSave_table_name</a> to listen for CiviEvent registrations.  I've implemented hook_civicrm_postSave_civicrm_participant($dao) where I test for certain status_id values and do something with a custom Drupal module.  Although this works for non-paid events, I noticed that it's not working for paid events.</p>
  
  <p>The reason is because during the payment process the status_id is '6', but when the payment is processed and the status_id changes to '1', the hook isn't called (The hook does get called when the database row is written with status_id 6).</p>
  
  <p>The documentation says "This hook will get called again with every update", but this doesn't seem to be the case.</p>
  
  <p>Is this a bug, or should I be getting the participant status update in a different way?</p>
  
Tags: <civievent><database><hooks>
Title: hook_civicrm_postSave_table_name not called on table update
ThreadText: # hook_civicrm_postSave_table_name not called on table update
  
  (Asked by: username_0 on 2017-02-28)
  
  In Drupal, I'm using [hook\_civicrm\_postSave\_table\_name](https://docs.civicrm.org/dev/en/master/hooks/hook_civicrm_postSave_table_name/) to listen for CiviEvent registrations. I've implemented hook\_civicrm\_postSave\_civicrm\_participant($dao) where I test for certain status\_id values and do something with a custom Drupal module. Although this works for non-paid events, I noticed that it's not working for paid events.
  
  The reason is because during the payment process the status\_id is '6', but when the payment is processed and the status\_id changes to '1', the hook isn't called (The hook does get called when the database row is written with status\_id 6).
  
  The documentation says "This hook will get called again with every update", but this doesn't seem to be the case.
  
  Is this a bug, or should I be getting the participant status update in a different way?
  
  **Tags:** civievent, database, hooks
  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_1 on 2018-01-03. Score: 1
  
  You can use hook\_civicrm\_post hook which gets called every time a core object is written to db. Detailed description can be found here: <https://docs.civicrm.org/dev/en/latest/hooks/hook_civicrm_post/>
  
  
  ---
  
  