Support

Home Forums Event Espresso Premium How can i get USER ID (who bought the ticket) for every attande?

How can i get USER ID (who bought the ticket) for every attande?

Posted: April 16, 2015 at 10:59 am

Viewing 7 reply threads


Kish Parmar

April 16, 2015 at 10:59 am

I need to make realtions / grouping on attendees in the Export CSV. So i need to know What user bought the tickets for the attandees , what user ID. Think this is really important im just wondering how is it not already in the plugins?

Also i need to get this on the single Event pages, as i have to hide the required Ticket type, if its already ordere by the current user with the FHEE__ticket_selector_chart_template__do_ticket_entire_row filter.

Please let me know its urgent.

Im using Version 4.6.19.p


Kish Parmar

April 16, 2015 at 11:04 am

Basically im using this to get all attandees to an event :

$sql = "SELECT * ";
$sql .= "FROM {$wpdb->prefix}esp_attendee_meta ";
$sql .= "INNER JOIN {$wpdb->prefix}esp_registration ";
$sql .= "ON {$wpdb->prefix}esp_attendee_meta.ATT_ID = {$wpdb->prefix}esp_registration.ATT_ID ";
$sql .= "WHERE {$wpdb->prefix}esp_registration.EVT_ID = %d";

$attendees = $wpdb->get_results( $wpdb->prepare( $sql, $event_id ));

but i need an additional ID which is saying Which User ID bought the ticket (which is the member).

a code snippet would be great, dont know what table needs to be joined.

Best regards


Dean

April 17, 2015 at 2:03 am

Hi,

“What user bought the tickets for the attandees , what user ID”

The Primary attendee is always the first registered for the group.

In the spreadsheet, the attendees will share the same Transaction ID and will be part of the same “Count of this registration in the group registration [REG_count]” column, with the “1 of X” being the Primary Attendee.

I hope that helps, let me know if you have any other questions.


Kish Parmar

April 17, 2015 at 2:24 am

Yea, all above is per order basis.

So for example my Member decides to come back (after the first purchase, and member always logged in, must be, purchase is login restricted), and buy more tickets for other guest, friends, users, (as a second round), there is nothing common in the two purchases, no object parameter that could be a base of grouping different transactions / attendees by the same member (buyer), who bought the tickets.

Im trying to explain it very well.
I need to make queries, where im able to group attendees based on the Member, who bought the ticket per Event. Thats should be a Buyer ID; which is simply the same User ID for every different purchase.

This is good for checking, IF the user bought tickets already. Then i can hide Ticket Types.

Also good for a very good looking CSV Export Where all the attendees related to the Buyer.


Josh

  • Support Staff

April 20, 2015 at 10:42 am

Hi Kish,

This is already available in the registrations CSV, in the second column labeled “Attendee ID[ATT_ID]”. This is assuming that when the logged in user buys tickets for others, additional attendee info isn’t asked for.

When a logged in user registers and buys tickets, their ATT_ID from the esp_meta_attendee_meta table will be the same as as the ATT_ID on the esp_registration rows.

The ATT_ID is also related to the rows in the wp posts table. The ATT_ID will match the post ID there. The contacts are actually a custom post type called espresso_attendees.

One idea that might help in case the registration form gets the email addresses for every attendee (where the ATT_IDs may be unique) : You can also check the current user’s EE_Attendee_ID field from wp_user_meta, this will be the same as the ATT_ID in the other tables. Then you can do a query on the esp_registration table for the TXN_IDs where the current user’s ATT_ID is associated, then grab all the rows that match those TXN_IDs.


Kish Parmar

April 21, 2015 at 6:25 am

Hey josh,

thanks for useful reply, we already using something similar. Which is working, my problem is that If im coming back and book tickets for someone else. That is always updating my profile. As i see the regsitration forms’s First entry always updating the logged in users profile.

Can i turn that off somehow?

many thanks


Dean

April 21, 2015 at 7:09 am

Hi,

Currently that is not possible to turn off. If the user needs to register someone else, they should not be logged in when doing so.

I will add a feature request for you.


Josh

  • Support Staff

October 7, 2015 at 2:22 pm

Hi Kish,

The latest update to the WP User Integration includes a new option so you can turn off the sync to profile.

Viewing 7 reply threads

The support post ‘How can i get USER ID (who bought the ticket) for every attande?’ 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