Support

Home Forums Event Espresso Premium get WP_USER ID from a transaction

get WP_USER ID from a transaction

Posted: July 19, 2016 at 9:20 am

Viewing 2 reply threads


ARAGATO

July 19, 2016 at 9:20 am

I am trying to get the wp_user id of the registrant from an ee transaction. However, it always returns the wrong user_id. Why is that?

    $transactions = EEM_Transaction::instance()->get_all(
        array(
            array(
                'STS_ID' => 'TIN' 
            ) 
        ) 
    );
    
    foreach( $transactions as $transaction ) {
        
        $single_usr_from_trans = EEM_WP_User::instance()->get_one(
            array(
                array(
                    'Ticket.Registration.Transaction.TXN_ID' => $transaction->get('TXN_ID')
                ) 
            ) 
        );
        
        echo $single_usr_from_trans->get('ID');
                                          
    }


Josh

  • Support Staff

July 19, 2016 at 3:34 pm

That’s not a valid model relation.

You could get the registration from the Transaction, where you can get the Attendee ID. Then you can query for the related user with the WP User Query class. e.g.


ARAGATO

July 20, 2016 at 3:58 am

Wow, excellent work Josh.
Resolved.

Viewing 2 reply threads

The support post ‘get WP_USER ID from a transaction’ 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