christianwach / civicrm-wp-profile-sync

Keeps a WordPress User profile in sync with a CiviCRM Contact and integrates WordPress and CiviCRM Entities with data synced via Advanced Custom Fields.
https://wordpress.org/plugins/civicrm-wp-profile-sync/
GNU General Public License v2.0
13 stars 17 forks source link

Added support for having acf join group form action use a dynamic civi group id #49

Open wcha-peter opened 1 year ago

wcha-peter commented 1 year ago

Hi,

I was wanting support for more dynamic selection of the Civi group id that a user gets added to in the ACF Form Civi group join action, in my case for determining the group id from a custom field on the current WP post.

I've added an entry in the list of groups with ID 0 to avoid conflicting with any of the civi groups, and when the action runs had it get the id from a filter. Not sure if my GUI approach of having it in the existing list of groups is a great option but seemed like the simplest solution.

Best wishes, Peter

christianwach commented 1 year ago

@wcha-peter Thanks for the PR but you can already do this without any code changes. Use {get_field:my_field} as per the ACF Extended docs.

Cheers, Christian

wcha-peter commented 1 year ago

Hi @christianwach,

Not sure if this gives us the functionality we're looking for. I'm looking to dynamically pick the group to join, which seems to currently only have the option to select from the list of civi groups, not any dynamic values: image

There is the option to put a dynamic tag in the 'Conditional On' field, but this leads to needing a group action for every group we want to interact with, which in our case is ~100, so would be good to have a way to pick the Group field dynamically.

Best wishes, Peter

christianwach commented 1 year ago

@wcha-peter Ah, sorry, I see what you mean. That field doesn't allow "magic tags" to be used. Converting the reference such that it does seems to be the way to go. I've re-opened this as a reminder.

wcha-peter commented 1 year ago

@christianwach I've pushed an updated version of the changes which seem to be more in line with what you had in mind. I've just re-enabled the ui field for the groups field.

Please let me know if that's in line with what you were planning?