Skip to content

Instantly share code, notes, and snippets.

@joshfeck
Last active March 6, 2022 21:14
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save joshfeck/2165ff295c968f861cef8775fc8b1dc9 to your computer and use it in GitHub Desktop.
Save joshfeck/2165ff295c968f861cef8775fc8b1dc9 to your computer and use it in GitHub Desktop.
How to sync a WordPress user account to an Event Espresso Contact. This is useful if you've installed the WP User Integration after registrations have already been recorded.

Step 1 -- Gather the user and Event Espresso Contact IDs

You can get the user ID from the WP Users page. You can get the Event Espresso Contact ID from the Event Espresso > Registrations > Contact list admin page.

Image of EE Contact List

In this example, the user ID is 18 and the Event Espresso Attendee ID is 862.

Step 2 -- Install the Debug Bar and Debug Bar console plugins

Available here: Debug Bar Debug Bar Console

Step 3 -- PHP code

You click on the Debug Bar link, then Console add add the following code, replacing the User ID and Meta Value.

<?php
global $wpdb;
$user_id = 18;
$meta_key = $wpdb->prefix . 'EE_Attendee_ID';
$meta_value = 862;
add_user_meta( $user_id, $meta_key, $meta_value, true );
?>

Then you click Run.

@joshfeck
Copy link
Author

joshfeck commented Mar 8, 2018

The Debug Bar Console plugin should be fine if you're using WP 4.9.4 or greater.

@akimbokm
Copy link

akimbokm commented Mar 6, 2022

If anybody out there is still needing to use this code, like me, I have used it with the Code Snippets plugin rather than using Debug Console, since I already have that plugin installed for other reasons. I made a new snippet that is set to only run once. Worked like a charm. Thank you Josh for keeping this post here!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment