christianwach/civicrm-acf-integration

Are your "CiviCRM Relationship" a bidirectional relationship field ?

Closed this issue · 10 comments

Hi,
I guess everything is in the title ?
can it be a many to many across several contact types?
can it be a many to many between two contact types ?

Cheers

can it be a many to many across several contact types?

Yes, IIRC

can it be a many to many between two contact types ?

Also yes, IIRC :-)

Ho boy !

So, with two custom post types, one for organisation and one for individual, each sync to their conterpart in Civi, I add a custom CiviRelationship field to each and they are synced with Civi !

Excellent !

That's a pretty (a hell) of a powerfull plugin you built !

So, with two custom post types, one for organisation and one for individual, each sync to their conterpart in Civi, I add a custom CiviRelationship field to each and they are synced with Civi !

Yes. Have you tried it? Let me know if it doesn't work for you for some reason.

No yet, just thrilled ahead !

Ok, the relathionship is working !

That's cool but...

The value of the field is the contact ID in Civi... I would like to have the value of the post id of the organisation, because with this I can't do much without heavy php lifting.

Or... Or, it is possible to sync a Civi contact ID into a wp custom field ? then I may do some "slight wp only queries !

heavy php lifting.

@jbonlinea This doesn't seem heavy:

// Find the Post that a Contact is synced with.
$cai = civicrm_acf_integration();
$post = $cai->post->get_by_contact_id( $contact_id );

:-)

@jbonlinea FYI, I have written a read-only "CiviCRM Contact ID" field and it will be included in an upcoming version of this plugin. It only populates with the Contact ID of the Contact that is synced to a Post, so you'd still need to use the code in my previous comment to retrieve "Related Contacts". I might be able to do something (at some point) with the "Return Format" field setting, so I'll leave this open as a reminder.

I have written a read-only "CiviCRM Contact ID" field

Update: this is available in the latest version (0.7)

Hi @christianwach

That's super cool !

I'm a bit busy with the UX/UI lately thus haven't worked on CiviCRM matter but I'll get back to that and definitely give the brain time your replies deserves :)

Cheers

Closing because I am archiving this repo in favour of CiviCRM Profile Sync.