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

Merge to Core? #2

Closed kcristiano closed 9 years ago

kcristiano commented 9 years ago

Hi Christian,

Do you think this functionality would be a good candidate to merge into core?

Secondly, I have an extension (for CiviCRM 4.4) that does this, plus grabs data from a custom field (file upload) and adds that data to user_meta. Is there a way to extend this plugin to take care of cases like this?

christianwach commented 9 years ago

@kcristiano I'm not sure... the plugin does some things that may seem a bit peripheral to some, like compatibility with BuddyPress. If it were to be merged, a lot of the functionality should probably go into CiviCRM itself, rather than the Civi WordPress plugin.

Could you point me to your extension so I can understand better what it does?

Cheers, Christian

kcristiano commented 9 years ago

Good points.

@christianwach Thaks for the quick response

My Work in Progress is this -- https://github.com/tadpolecc/cc.tadpole.wpcontactupdate/tree/develop A good amount of hard coded values for now as I am testing for one client.

I am looking to have in core the ability to sync basic profile data First Name, Last name, email for sure. That has gone out of sync on me and I hate it.

If we merged your bits in with 4.6 I'd imagine your plugin would only need the BP specific code.

Kevin

Just thinking now. I may instead just have to clean this up

christianwach commented 9 years ago

@kcristiano Thanks for pointing me to the code. Am I right in thinking that you're doing a Civi-to-WordPress sync by targeting the contact form? I tried to hook into civicrm_pre and civicrm_post only, to make sure that I didn't miss places where values were changed. YMMV, of course!

The issue with trying to do this in CiviCRM core is that preventing recursion gets more complicated without the ability to remove hooks - which is why I wrote this on the WordPress side. Your thoughts on this would be most welcome.

kcristiano commented 9 years ago

@christianwach I did it this way as I am stuck in 4.4 for this client.

I was converting it to a WP plugin when I saw yours and I stopped :). I will try and extend yours to get the custom fields I need syncd.

Let me think about the issues you bring up. Drupal syncs the users and that is the feature I am trying to get in civicrm-wordpress. I am working at the Denver sprint, so I will see if anyone here has ideas.

christianwach commented 9 years ago

@kcristiano Ah, okay, I wasn't clear about that... you can of course use the new WordPress.php hooks file and my plugin will work just fine :)

It'd be good to have expert Drupal eyes on the issue - if they can point to where the sync is taking place, there's surely much to be learnt. Keep me in the loop and have a great time!

kcristiano commented 9 years ago

@christianwach I will do that. You anticipated my next question -- Can I use your 4.4 branch of Hooks and get your plugin to run? Fantastic.

I will attempt to create another plugin to extend the class and do the custom field sync as well. That may be beyond me, but I will git it a try.

christianwach commented 9 years ago

Can I use your 4.4 branch of Hooks and get your plugin to run?

Yes, indeed. At least you'll have access to hooks, even if the integration with shortcodes falls, er, short.

BTW, if you're working with option_value entities, you will have to use civicrm_postProcess, since (IIRC) they don't trigger civicrm_pre and civicrm_post when they're updated.