CiviCRM Community Forums (archive)

*

News:

Have a question about CiviCRM?
Get it answered quickly at the new
CiviCRM Stack Exchange Q+A site

This forum was archived on 25 November 2017. Learn more.
How to get involved.
What to do if you think you've found a bug.



  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Developer Discussion »
  • APIs and Hooks (Moderator: Donald Lobo) »
  • Hook on new line item
Pages: [1]

Author Topic: Hook on new line item  (Read 593 times)

sdragnev

  • I post occasionally
  • **
  • Posts: 40
  • Karma: 0
  • CiviCRM version: 4.6.2
  • CMS version: Drupal 7
  • PHP version: 5.4
Hook on new line item
March 20, 2012, 07:16:04 am
Hi all,

I'm trying to fire a hook upon the creation of a new line item for a new event participant.

I tried using hook_civicrm_post with $op == create and $objectName == Participant, but it appears that civicrm_line_item is not yet populated at that point.

What's the best way to get the new line item for the new participant?

Thanks!

Erik Hommel

  • Forum Godess / God
  • I live on this forum
  • *****
  • Posts: 1773
  • Karma: 59
    • EE-atWork
  • CiviCRM version: all sorts
  • CMS version: Drupal
  • MySQL version: Ubuntu's latest LTS version
  • PHP version: Ubuntu's latest LTS version
Re: Hook on new line item
March 20, 2012, 11:10:27 am
Do you want to do something before or after the database is updated? If after works, I would use the postProcess hook, otherwise the pre hook.
Consultant/project manager at EEatWork and CiviCooP (http://www.civicoop.org/)

sdragnev

  • I post occasionally
  • **
  • Posts: 40
  • Karma: 0
  • CiviCRM version: 4.6.2
  • CMS version: Drupal 7
  • PHP version: 5.4
Re: Hook on new line item
March 21, 2012, 05:35:01 am
Thanks!

I thought postProcess may be harder to use than a trigger on new participant, but it seems like the form has a [_lineItem] index which gives me exactly what I need.

Pages: [1]
  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Developer Discussion »
  • APIs and Hooks (Moderator: Donald Lobo) »
  • Hook on new line item

This forum was archived on 2017-11-26.