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) »
  • A hook_civicrm_custom - "pre"?
Pages: [1]

Author Topic: A hook_civicrm_custom - "pre"?  (Read 469 times)

KarinG

  • I post frequently
  • ***
  • Posts: 134
  • Karma: 9
  • CiviCRM version: 4+
  • CMS version: Drupal 6 / 7
  • MySQL version: MariaDB
  • PHP version: 5.3/5.4/5.5
A hook_civicrm_custom - "pre"?
April 13, 2014, 01:31:43 pm
Hi!

Is there a way to figure out the "pre" values of fields in civicrm_custom groups? I need to do something hook_civicrm_custom (so post) but (preferably) only if one specific custom value has changed from 0 to 1.

-- Karin

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: A hook_civicrm_custom - "pre"?
April 14, 2014, 12:27:53 am
I do not think there you can retrieve the pre-values in the custom hook? You would probably have to solve it by storing the custom values temporarily based on the pre hook with the entity related to your custom field?
Consultant/project manager at EEatWork and CiviCooP (http://www.civicoop.org/)

KarinG

  • I post frequently
  • ***
  • Posts: 134
  • Karma: 9
  • CiviCRM version: 4+
  • CMS version: Drupal 6 / 7
  • MySQL version: MariaDB
  • PHP version: 5.3/5.4/5.5
Re: A hook_civicrm_custom - "pre"?
April 14, 2014, 10:59:25 am
Hoi!

Ah I see. So a hook_custom_pre for Contact -> then storing that value -> then comparing that value the new value in the hook_civicrm_custom. Ok, will try that!

-- Karin

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: A hook_civicrm_custom - "pre"?
April 14, 2014, 11:05:43 am
Yep, that should do the trick
Consultant/project manager at EEatWork and CiviCooP (http://www.civicoop.org/)

KarinG

  • I post frequently
  • ***
  • Posts: 134
  • Karma: 9
  • CiviCRM version: 4+
  • CMS version: Drupal 6 / 7
  • MySQL version: MariaDB
  • PHP version: 5.3/5.4/5.5
Re: A hook_civicrm_custom - "pre"?
April 14, 2014, 11:07:10 am
Bedankt!

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: A hook_civicrm_custom - "pre"?
April 14, 2014, 11:19:10 pm
Alsjeblieft  ;)
Consultant/project manager at EEatWork and CiviCooP (http://www.civicoop.org/)

Pages: [1]
  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Developer Discussion »
  • APIs and Hooks (Moderator: Donald Lobo) »
  • A hook_civicrm_custom - "pre"?

This forum was archived on 2017-11-26.