- Issue created by @commonpike
- First commit to issue fork.
- Merge request !7#3530402 If contact_id is not present in ObjRef variable then find record → (Open) created by Unnamed author
I honestly don't know if this is an issue in version 8*. I found this in a Drupal 7 installation, see https://civicrm.stackexchange.com/questions/49552/membership-statusses-n...
I am surprised I found no bug reports about it here - perhaps they were there in the 7* version.
CRM_Member_BAO_Membership::updateAllMembershipStatus , which is called from scheduled jobs, writes its own record since 5.76. As a result, when CRM_Core_DAO::writeRecord is called, it triggers CRM_Utils_Hook::post which is what `hook_civicrm_post` receives. However, this is now a very shallow object and does not contain a contact_id anymore.
I can see in the 8.* code `civicrm_member_roles_civicrm_post` expects this contact_id. It looks like it will properly fail if it isn't there and not update the associated user. The 7.* seems to fail worse.
The shallow `$objref` does contain the membership id. You should be able to find the contact id using that.
Active
1.0
Code