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) »
  • Check where request is coming from in post hook
Pages: [1]

Author Topic: Check where request is coming from in post hook  (Read 494 times)

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
Check where request is coming from in post hook
April 03, 2013, 03:19:13 am
We are working on a synchronization project, where emailaddresses are kept synched between CiviCRM and Simplelists (webapp for mailinglists). We use the API to send and receive data. On the CiviCRM side the post hook is used to catch any updates in CiviCRM. However, if a create action is issued from the API, the post hook is also triggered. And quite rightly so as there is a create action. As far as I know there is no way in which to determine if the create requests originates from the API or from the core CiviCRM UI.

Any ideas on how we might be able to hold where a create action originates from? Could we add something to the $config?
Consultant/project manager at EEatWork and CiviCooP (http://www.civicoop.org/)

xavier

  • Forum Godess / God
  • I’m (like) Lobo ;)
  • *****
  • Posts: 4453
  • Karma: 161
    • Tech To The People
  • CiviCRM version: yes probably
  • CMS version: drupal
Re: Check where request is coming from in post hook
April 03, 2013, 10:17:26 am
Hi,

You can set a global variable in a hook that is triggered only in the UI (eg validate) and check if that global variable is set in the post.

Hackish but should get the stuff done...
-Hackathon and data journalism about the European parliament 24-26 jan. Watch out the result

Pages: [1]
  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Developer Discussion »
  • APIs and Hooks (Moderator: Donald Lobo) »
  • Check where request is coming from in post hook

This forum was archived on 2017-11-26.