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 for membership changes?
Pages: [1]

Author Topic: hook for membership changes?  (Read 875 times)

rimu

  • I’m new here
  • *
  • Posts: 14
  • Karma: 0
  • CiviCRM version: 3.4.8
  • CMS version: Drupal 6
hook for membership changes?
March 10, 2011, 12:34:39 pm
Hi all

Is there a hook that gets fired when a contact joins and gets a membership? 
I'm asking because I'd like to sync their membership with certain drupal roles as soon as they join, not on cron run when everyone gets their roles sync via the civicrm_member_roles module.

Thanks!

Rimu

TwoMice

  • I post frequently
  • ***
  • Posts: 214
  • Karma: 16
    • Emphanos
  • CiviCRM version: Always current stable version
  • CMS version: Drupal 7
Re: hook for membership changes?
March 10, 2011, 12:51:05 pm
Hi Rimu,

Have you tried hook_civicrm_post (http://wiki.civicrm.org/confluence/display/CRMDOC33/CiviCRM+hook+specification#CiviCRMhookspecification-hookcivicrmpost)?

- TM
Please consider contributing to help improve CiviCRM with the Make it Happen! initiative.

rimu

  • I’m new here
  • *
  • Posts: 14
  • Karma: 0
  • CiviCRM version: 3.4.8
  • CMS version: Drupal 6
Re: hook for membership changes?
March 10, 2011, 04:13:40 pm
Yeah, that does look like one way to do it, although I'm holding out for a more targetted way. Intercepting every database access from anywhere in Civicrm by anyone and then trying to pick out the right one seems clumsy.

Donald Lobo

  • Administrator
  • I’m (like) Lobo ;)
  • *****
  • Posts: 15963
  • Karma: 470
    • CiviCRM site
  • CiviCRM version: 4.2+
  • CMS version: Drupal 7, Joomla 2.5+
  • MySQL version: 5.5.x
  • PHP version: 5.4.x
Re: hook for membership changes?
March 10, 2011, 04:46:51 pm

yeah, thats one of the main disadvantages of the hook system (and our implementation).

at some stage in the future, we'll make the pre/post and the formHooks specific to an object / form /page and hence avoid the conditional on objName / formName / pageName

lobo


A new CiviCRM Q&A resource needs YOUR help to get started. Visit our StackExchange proposed site, sign up and vote on 5 questions

rimu

  • I’m new here
  • *
  • Posts: 14
  • Karma: 0
  • CiviCRM version: 3.4.8
  • CMS version: Drupal 6
Re: hook for membership changes?
March 10, 2011, 06:13:54 pm
Sounds like I need to toughen up. Thanks guys :)

Pages: [1]
  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Developer Discussion »
  • APIs and Hooks (Moderator: Donald Lobo) »
  • hook for membership changes?

This forum was archived on 2017-11-26.