Support

Home Forums Event Espresso Premium Link between (prefix)EE_ATTENDEE_ID and other data

Link between (prefix)EE_ATTENDEE_ID and other data

Posted: August 18, 2016 at 11:59 am

Viewing 10 reply threads


Samantha

August 18, 2016 at 11:59 am

Hello…was wondering if this post is still valid:

https://eventespresso.com/topic/how-can-i-get-user-id-who-bought-the-ticket-for-every-attande/

because my EE_ATTENDEE_ID (in my case, WP_EE_ATTENDEE_ID) does not seem to have a relationship anywhere. I have an example attendeeID that I’ve looked up from the wp_usermeta table with the value 5969. There exist no ATT_ID with this number in the wp_esp_registration table, nor is there a postID with this value. I can look up this same user’s “real” ATT_ID which is 15307 and can find no WP_EE_ATTENDEE_ID in the wp_usermeta table with that value. Despite all this weirdness…everything is working properly and the user, registrations, links to the wp_user table, all of it is working properly.

So….I’m wondering if the relationship has changed or if I’m doing something wrong?

Ultimately I’m trying to synch up data from one of the questions to a custom user meta field I have setup. When that is completed, I need to modify the filter that pulls the answers from a previous registration to pull my field instead of the previous answer, for this one field only (and still pull the other answers normally if they exist). If you can also provide any guidance that would be helpful…that would be awesome ๐Ÿ™‚ Thank you!!!


Josh

  • Support Staff

August 18, 2016 at 1:27 pm

I have an example attendeeID that Iโ€™ve looked up from the wp_usermeta table with the value 5969.

Which value are you looking at in the wp_usermeta table? Is it the umeta_id, the user_id, or the meta_value? The meta_value will match the ATT_id (and the contact record’s post ID). If there’s no post with ID 5969, then I should ask have either of the database reset buttons on the Event Espresso > Maintenance page been put to use on this site?


Samantha

August 18, 2016 at 4:47 pm

I have not clicked any of those buttons, I don’t believe…but I really can’t be sure. I know that I reset the data a couple of times when we were attempting to import and we had issues. So back at the very beginning to reset all data and start from scratch, we may have clicked the one button that resets all the data back to install. Or not. Not sure. I’m sorry. I don’t think I”ve ever clicked the other one, because we haven’t had problems with accounts linking and I didn’t want to jinx it? I wanted to ask first how you figure out that someone is tied to a user account? What fields do you test to make a match?

Yes I am looking at the meta_value for wp_EE_Attendee_ID, which is 5969 for user_id 3783. In the wp_posts, this user is post_ID 15307 which is also the ATT_ID for her. How are these relationships being maintained….I mean, if I login as her, I can look at her user profile and the event she attended is listed there. If I click on the link to access her user from EE, it takes me right to her in the user database. I’m just at a loss to understand how the relationship is currently working.


Josh

  • Support Staff

August 19, 2016 at 2:11 pm

The thing is the relationships on your site are currently not working, and it’s most likely because of the database resets that were done earlier. What you can do is go into the wp_usermeta table and delete any of the rows that have wp_EE_Attendee_ID for the meta key. Then the next time you register for an event while logged into that account, a correct wp_EE_Attendee_ID key/value pair will be written to the database.


Samantha

August 28, 2016 at 3:26 pm

Sooo is there a quick way to trigger it to mass update the relationships? ๐Ÿ™‚


Samantha

August 28, 2016 at 3:28 pm

Wow so now I’m really at a loss as to how it’s relating the fields. I deleted those records…..and they’re still linked up.


Samantha

August 28, 2016 at 3:30 pm

I really needs to know what criteria you look at when determining a match. It can’t be email address because we don’t have unique email addresses. I believe I asked about this before we purchased our license but I’m just checking one more time because it worries me not knowing. IT also worries me that I’m looking at my registrations in my user profile, and yet there is no meta key for me in the table.


Samantha

August 28, 2016 at 4:26 pm

It also appears to do the link if you login to the profile and save it. Ok it seems to handle my duplicate emails in stride…thank you for not making that the only criteria for a match ๐Ÿ™‚ Now..if we can just get a way to force these to mass update…because at the end of the day, what I need to do is synch up one of the answers with a custom user meta. This is a field that is really only for staff, so we really don’t want it on the answers. It’s causing our staff extra work to have to register the user by logging in as that person, and then sometimes or sometimes not the previous answers come over….and then they have to go back into the backend as themselves so that they can add the admin only answer to the registration. All I need is for this to show up on a report….so I don’t know….I guess if there was a way to pull custom meta to the report….that would also work?


Josh

  • Support Staff

August 29, 2016 at 4:15 pm

It might work the best to add an admin-only question to the registration form question group for those events, then auto populate the admin-only answer field with that user’s meta field value at the time. This way, if the value changes going forward, future registrations will get the new value.


Samantha

August 29, 2016 at 5:38 pm

1.) most important! I need a way to force these relationships to mass update, I can’t wait for people to login before it creates the relationship, because we have reports that we do each month and the data needs to be there. I can’t do them manually because we have over 4000 users. ๐Ÿ™‚
2.) in order for me to pull meta that way, #1 has to happen ๐Ÿ˜‰ Also:
3.) I am able to look at the hook for pulling in the previous answers, Ok..the code where you’re bringing in the address fields, very straightforward! If I were to need to pull these from the meta I could do it. But, the answers are not as straightforward. I have no idea what the format of the array is that’s being used to grab the data or how to stick my value into which field in order to grab my meta value instead. So yes, I understand how to get the meta, and I have the hook that pulls the previous answers that I need to modify to pull from this meta field instead (for one of the answers) but can someone explain the array and which value I’d need to replace. It’s just not apparent looking at the code.


Josh

  • Support Staff

August 30, 2016 at 5:10 am

For #1, you can derive some code from a private method from the WP Users add-on where it connects a WP user account with a contact. You can have a look at EED_WP_Users_Admin.module.php’s _connect_wp_user_with_contact() method. If the user accounts do not have registrations yet, you could also derive some code from _create_attendee_and_attach_wpuser() (in the same file), then when your function loops through all user accounts it will also create an Event Espresso Attendee record.

I have no idea what the format of the array is thatโ€™s being used to grab the data or how to stick my value into which field in order to grab my meta value instead.

It may help you if you take a look at the esp_answers table. You’ll note that each row there has a link to the Registration (REG_ID), then a link to the Question (QST_ID) which could point to your admin-only question, then a value. So one idea you could try is fire a script that runs while the registration is being processed, that adds a row to the esp_answer table inserts the ANS_value based on the user meta value.

Viewing 10 reply threads

The support post ‘Link between (prefix)EE_ATTENDEE_ID and other data’ 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