I have a CiviCRM database on my WordPress site. When new members sign up for our organization they create a CiviCRM account via the profile. Later they create accounts in WordPress to access certain members-only sections of the site. I do not want these WordPress accounts to sync. How can I disable that feature? I am now getting many duplicate records (and I need to allow duplicates as we have individual records -- children -- with same email -- parent).


You can unhook CiviCRM's hook callbacks like this:

add_action( 'plugins_loaded', 'my_disable_civi_user_sync' );
function my_disable_civi_user_sync() {
    if ( ! function_exists( 'civi_wp' ) ) return;
    remove_action( 'user_register', array( civi_wp()->users, 'update_user' ) );
    remove_action( 'profile_update', array( civi_wp()->users, 'update_user' ) );
    remove_action( 'deleted_user', array( civi_wp()->users, 'delete_user_ufmatch' ), 10 );

Disclaimer: this is untested code. You may need to hook into a later action, e.g. init.

| improve this answer | |

When members sign up you can give them the option of creating a WordPress account at that time. It is in the Advanced Settings of the profile. You can give the option or require account creation.

This will not stop the sync but should reduce the number of duplicates.

Hope it helps...

| improve this answer | |

From reading between the lines of your question, I think you're taking the wrong approach. Rather than not syncing the contacts, why not prevent deduplication unless the names, DOBs, and the emails are the same? This is doable through the interface, allows you to have genuine matches between accounts where correct, and meets the need you stated.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.