Home Forums Event Espresso Premium Not getting EE_Attendee_ID

Not getting EE_Attendee_ID

Posted: January 7, 2021 at 11:04 am

Antenna Digital

January 7, 2021 at 11:04 am

I had this code in place and it was working. It checks for any unpaid event registrations and outputs a message/link rather than letting the user register for the event.

It has stopped working (don’t know when)
I believe the issue is that this line returns bool(false)
$att_id = get_user_option( ‘EE_Attendee_ID’, $user->ID );

If I hard code the ID things work as expected.
//$att_id = 24346;
(This test user has an unpaid registration)

$user->ID outputs the correct WP User (1292)
$att_id = get_user_option( ‘EE_Attendee_ID’, $user->ID ); outputs FALSE

Any ideas what might be going on?

// look for outstanding payments for events in Event Espresso
$user_regs = array();
$user = wp_get_current_user();
$att_id = get_user_option( 'EE_Attendee_ID', $user->ID );
//$att_id = 24346;
$contact = EEM_Attendee::instance()->get_one_by_ID( $att_id );
if ( $contact instanceof EE_Attendee ) {
$regs = $contact->get_many_related( 'Registration' );
foreach ( $regs as $reg ){
$user_regs[] = $reg->get( 'STS_ID' );
} // loop here

if( in_array( 'RPP', $user_regs ) ) {
$msg_2 = '<div class="alert alert-warning mb3">
<p class="bold">There seems to be an outstanding invoice for an event registration. Please go to your account to review & pay your invoice. </p>
$show_tickets = false;
} else {
if (! $member_error) {
$show_tickets = true;


  • Support Staff

January 7, 2021 at 1:38 pm

Hi there,

$att_id = get_user_option( ‘EE_Attendee_ID’, $user->ID );

Will return false if the EE_Attendee_ID metadata doesn’t exist for the user.

Whilst you’ve hard coding a test contact above, was the registration for that created on the front end of the site whilst logged into that test account?

$att_id = 24346;

May well be the ID of the contact linked to that registration, but has that user account set up the EE_Attendee_ID user meta data linking the user to the EE_Contact (by registering onto an event using matching details for the WP User whilst logged in)?

If you edit the EE Contact with ID 24346 does it show a linked WP User? Like this:

If not then it’s not linked to a WP User account

Antenna Digital

January 7, 2021 at 1:56 pm

Ahh. That makes sense now. I created the registration from Admin since I’m trying to set up a test account so the client can see what happens when a user has unpaid registrations.

I’ll go back and complete a registration from the front end and I’m thinking that will resolve the issue.

As always, I appreciate the timely and detailed advice/response.


  • Support Staff

January 7, 2021 at 2:38 pm

You’re most welcome, please do let me know if you run into further issues.

The support post ‘Not getting EE_Attendee_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.

Support forum for Event Espresso 3 and Event Espresso 4.
Documentation for EE3 and EE4
Documentation for Event Espresso 3 Documentation for Event Espresso 4

Status: closed

Updated by  Tony 2 weeks, 4 days ago ago

Topic Tags


This topic is: not resolved
Do NOT follow this link or you will be banned from the site!