I have the EventOn plugin, and I'm trying to generate and display a list of user accounts who have purchased a ticket to an event.
The two relevant tables in the DB are the wp_posts and wp_postmeta tables. Below is the csv export of the relevant information from them in a google doc: https://docs.google.com/spreadsheets/d/1cJCr5Nw6a_ssJMo8xoJOJjHU0r97xzs-olcA-7TQhXw/edit?usp=sharing I can provide phpMyAdmin access to someone who wants it if it would help to look around.
The first sheet is wp_post table. Second sheet is wp_postmeta. The wp_post ID column is connected to the wp_postmeta table by the post_id column. The wp_postmeta table data there is an example of one purchase. There are more just like it just with a different post_id.
What I need is a SQL statement or a WP_Query statement to get a list of names from the wp_postmeta table for a specific event.
Here's what I've tried so far:
SQL Statement -
SELECT wp_postmeta.meta_value
FROM wp_postmeta
INNER JOIN wp_posts
ON wp_posts.ID=wp_postmeta.post_id
where wp_posts.post_type='evo-tix'
AND wp_postmeta.meta_key='name';
WP_Query -
$args = array(
'post_type' => 'evo-tix',
'meta_key' => '_eventid',
'meta_value' => get_the_ID(),
'meta_compare' => '=',
);
$query = new WP_Query( $args );
The issue with the SQL statement is that it gives me the names of all purchased for all events. Not sure how to specify an _eventid (from the wp_postmeta table) with it.
The issue with the WP_Query is that it only pulls information from the wp_posts table. It confines it to the correct event (the get_the_ID() method brings in the correct ID/meta_value to be compared to the _eventid meta_key), but I can't get the names from the wp_postmeta table with it.
I'm not sure where to go from here, so any help would be appreciated. If I can help clear something up, let me know. I'm not sure how good of a job I did explaining.