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) »
  • PostProcess updating of related contacts of Membership doesn't work
Pages: [1]

Author Topic: PostProcess updating of related contacts of Membership doesn't work  (Read 655 times)

Michael McAndrew

  • Forum Godess / God
  • I live on this forum
  • *****
  • Posts: 1274
  • Karma: 55
    • Third Sector Design
  • CiviCRM version: various
  • CMS version: Nearly always Drupal
  • MySQL version: 5.5
  • PHP version: 5.3
PostProcess updating of related contacts of Membership doesn't work
February 13, 2012, 09:10:55 am
Hey there.

I have a postProcess firing on CRM_Contribute_Form_Contribution_Confirm to handle joint memberships
code here: https://github.com/michaelmcandrew/gp/blob/master/modules/custom/gpew_membership/gpew_membership.module

It basically:
1) creates a new contact based on some extra fields in the form
2) creates a relationship between the new contact and the contact that is filling in the form

I was hoping that this would be enough to inherit the membership but it wasn't so I did a call to CRM_Member_BAO_Membership::createRelatedMemberships (on line 302).

That worked when I chose pay later, but when i did it via the entering card details route, it didn't.

Having looked through the code, in this file https://github.com/michaelmcandrew/gp/blob/master/modules/civicrm/CRM/Member/BAO/Membership.php in createRelatedMemberships in the foreach loop from 1905 to 1920, it seems that the $relatedContacts array doesn't get populated hence no relationships are created.

Anyway, having got there, I felt like I had done my homework and could legitimately write a blog post and ask for help :)

Michael
Service providers: Grow your business, build your reputation and support CiviCRM. Become a partner today

Michael McAndrew

  • Forum Godess / God
  • I live on this forum
  • *****
  • Posts: 1274
  • Karma: 55
    • Third Sector Design
  • CiviCRM version: various
  • CMS version: Nearly always Drupal
  • MySQL version: 5.5
  • PHP version: 5.3
Re: PostProcess updating of related contacts of Membership doesn't work
February 14, 2012, 02:02:58 pm
Well i hacked this by setting a variable in Confirm and then using it in BuildForm on thankyou when i knew that i really was postProcessing that form.  Not very elegant but didn't have the brain time to dedicate to working out the root cause...
Service providers: Grow your business, build your reputation and support CiviCRM. Become a partner today

Pages: [1]
  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Developer Discussion »
  • APIs and Hooks (Moderator: Donald Lobo) »
  • PostProcess updating of related contacts of Membership doesn't work

This forum was archived on 2017-11-26.