Support

Home Forums Event Espresso Premium Reconciling non-logged in user purchase to an existing member purchase

Reconciling non-logged in user purchase to an existing member purchase

Posted: May 3, 2022 at 9:12 am


ICLE

May 3, 2022 at 9:12 am

We need to run in non logged in mode for awhile so the plugin “EE WP-Users” will be turned off.
This allows unlogged in users to purchase. We have two fields which should allow us to eventually put the purchase records back into the member record (bar-number and email). I am looking for a method to reconcile these purchase records back to member records.


ICLE

May 3, 2022 at 9:15 am

Let me clarify: new purchase by unlogged person needs posting to a member’s list of purchases, as signified by key field of email or an ACF field we have set.


ICLE

May 3, 2022 at 4:42 pm

Think I found it.
https://gist.github.com/joshfeck/2165ff295c968f861cef8775fc8b1dc9


Joao Victor

  • Support Staff

May 3, 2022 at 4:52 pm

Hi there!

Thanks for contacting us!

I got you to want to sell an event that the customer doesn’t need to register on your website and keep this sale registered. I just want to say that every Registration made in your event is stored under the Dashboard > Event Espresso > Events > Your Event > Registrations

You will have everything stored there regarding the specific event.

Let me know if it works!


ICLE

May 3, 2022 at 5:07 pm

Well, didn’t work with Debug console nor Snippets. Is there a new tool for this function?


ICLE

May 3, 2022 at 5:40 pm

So, looks like the database tables have different names, etc than the example:

<?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 );
?>

^^Is the example^^
Did the table organization and names change over time? Maybe the JoshFleck post in github needs a little updating?

however I could not find the table ‘EE-Attendee_ID’ but I did find a table with the name ‘wp_esp_attendee_meta’, so exactly how should this PHP be formatted?


Tony

  • Support Staff

May 5, 2022 at 4:27 am

Hi there,

Did the table organization and names change over time?

No, they haven’t changed.

Maybe the JoshFleck post in github needs a little updating?

JoshFeck’s example isn’t using a table name, it’s defining a meta_key using the site’s database table prefix with $wpdb->prefix.

The reason it needs to do that is the prefix is definable within wp-config.php and can often be different from the default.

So the default would be wp_, meaning he could have used:

$meta_key = 'wp_EE_Attendee_ID';

But he uses the defined prefix so that it works dynamically on sites that change it:

$meta_key = $wpdb->prefix . 'EE_Attendee_ID';

Which would parse to ‘wp_EE_Attendee_ID’ if it hasn’t been changed on the site itself, or if it was changed to say xhagdhsnndf_, it would parse to xhagdhsnndf_EE_Attendee_ID as it needs to.

The other use case is when using WP Multisite, $wpdb->prefix returns the correct DB prefix for each individual sites table prefix, but now we are getting into a whole other level 🙂

So, having said that I tested Josh’s example and it works as expected for me, however, I have a different solution which may help you here:

https://gist.github.com/Pebblo/239dcbbab9514c13ba48fe3e8e9a5add

That snippet adds a ‘Contact ID’ metabox to the section used to edit Registrations (Event Espresso -> Registrations -> {click on the registration})

In this example the Registration is already assigned to Contact ID 62: https://monosnap.com/file/Sr3fNmBnqzV7ySUv9MmvwxhOQky9GG

Simply setting a different contact ID in that field and clicking the ‘Update Contact ID’ button will change that.

Is that what you are looking for?

(Note be careful when changing contact ID’s and make sure you are using the correct ID)

The support post ‘Reconciling non-logged in user purchase to an existing member purchase’ is closed to new replies.

Have a question about this support post? Create a new support post in our support forums and include a link to this existing support post so we can help you.

Event Espresso