Support

Home Forums Event Espresso Premium Get wp_userID from ATT_ID

Get wp_userID from ATT_ID

Posted: August 2, 2017 at 7:12 pm

Viewing 2 reply threads


mcgilloweek

August 2, 2017 at 7:12 pm

Hi,
Is there a way to get the wp_user_id of the user who registered for an event based on ATT_ID?

I’m using the sample code provided in this forum to add custom columns to the CSV export file. If I can get the user_id, I can more easily pull the additional wp meta data I need for the registrant into the new column I’m creating.

Here’s a rough example of what I’m trying to accomplish:

add_filter( ‘FHEE__EE_Export__report_registrations__reg_csv_array’, ‘espresso_add_meta_value_csv’, 10, 2);
function espresso_add_meta_value_csv( $reg_csv_array, $reg_row ) {
// example: get the user’s faculty

$att_id = $reg_row[ ‘Attendee_CPT.ID’ ];
$registrant_user_id = _______________ **need help with this**
$user_info = get_userdata($registrant_user_id);
$faculty = $user_info->faculty;

if ( $faculty != ” ) {
$reg_csv_array[ ‘Faculty’ ] = $faculty;
}
return $reg_csv_array;
}

As always, your help and guidance are very much appreciated.


Josh

  • Support Staff

August 2, 2017 at 7:24 pm

Hi there,

You’ll find an example in this gist:

https://gist.github.com/joshfeck/b1f4f0043d17a3bad24b0e96e92ff7f0#file-functions-php-L16


mcgilloweek

August 2, 2017 at 8:16 pm

Thank you – that solved it! Thanks for the super-fast response!

Viewing 2 reply threads

The support post ‘Get wp_userID from ATT_ID’ 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