Support

Home Forums WP User Integration Query User that have [NOT] booked an event

Query User that have [NOT] booked an event

Posted: March 29, 2016 at 8:16 am


d s

March 29, 2016 at 8:16 am

Hi,

i have a login protected booking system where every user can book just once.
Now i need a custom query as the following:

Query All users that have [not] booked more than zero events

Can you help me with this, so i can use it with WP All Export?

Thanks a lot in advance!
David


Josh

  • Support Staff

March 29, 2016 at 1:57 pm

Hi David,

One way to do this is look in the _usermeta table and check for a wp_EE_Attendee_ID meta_key for the user_id. If the user_id doesn’t have a row with a wp_EE_Attendee_ID meta_key, then they haven’t made a registration.


d s

March 30, 2016 at 1:25 am

Thanks Josh,

that would be a great and easy solution, but to me it seems not reliable. i found more almost 1000 keys and have 3000 users. But i only have 200 registrations.
is there a meta query that i can use to check if the EE_Attendee_ID is also in use or do you have another solution for me?
Would be great if i could just use WP_User_Query for that query.

thanks!!


Josh

  • Support Staff

March 30, 2016 at 7:42 am

Of course you can use WP_User_Query, why wouldn’t you?

May I ask, what’s the code you used that gave you 1000 results?


d s

March 30, 2016 at 7:50 am

is there a meta query that i can use to check if the EE_Attendee_ID is also in use or do you have another solution for me?


Josh

  • Support Staff

March 30, 2016 at 8:20 am

Have you tried using WP_User_Query to query the users that have the wp_EE_Attendee_ID meta_key? If you have some code that you tried, but it didn’t work, and you can post it into a github gist or paste bin, we can take a look and offer a suggestion.


d s

March 30, 2016 at 9:45 am

i was looking in the database for all wp_EE_Attendee_ID and the result was bigger than my total registrations.


Josh

  • Support Staff

March 30, 2016 at 12:10 pm

We’re interested in seeing a dump of that database because that should not be happening. Is that something you can send?


d s

March 31, 2016 at 12:28 am

Sorry, but thats no possible. The data is highly sensible. but i thnik maybe a user gets an id before submitting his registration. I have many people that go to the checkout but dont submit. could that be?


Tony

  • Support Staff

March 31, 2016 at 2:44 am

i was looking in the database for all wp_EE_Attendee_ID and the result was bigger than my total registrations.

Total approved registrations?

Or total registrations?

I have many people that go to the checkout but dont submit. could that be?

Do they provide details but then do not finalize on the last step? (the payment step)

The support post ‘Query User that have [NOT] booked an event’ 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