Support

Home Forums Event Espresso Premium Database schema question – where URL to event?

Database schema question – where URL to event?

Posted: July 29, 2017 at 1:47 pm

Viewing 2 reply threads


rhj4

July 29, 2017 at 1:47 pm

I an writing several plugins that integrate EE with SendInBlue. To accomplish this,
I have managed to reverse-engineer most of the database and produced this query:

SELECT
	p.ID AS ID,
	tt.term_id AS TermId,
	t.name AS EventType,
	t.slug AS EventTypeSlug,
	p.post_title AS EventName,
	p.post_content AS EventDescription,
	v.post_title AS Venue,
	m.EVT_phone AS Phone,
	CAST(dt.DTT_EVT_start AS date) AS StartDate,
	CAST(sUBTIME(dt.DTT_EVT_start,'7:00') AS time) AS StartTime,
	CAST(dt.DTT_EVT_end AS date) AS EndDate,
	CAST(SUBTIME(dt.DTT_EVT_end, '7:00') AS time) AS EndTime,
	dt.DTT_reg_limit AS Seats,
	(CAST(dt.DTT_reg_limit AS SIGNED) - CAST(dt.DTT_sold AS SIGNED)) AS Unsold
FROM wp_posts p
INNER JOIN wp_esp_event_meta m ON m.EVT_ID = p.ID
INNER JOIN wp_esp_event_venue ev ON ev.EVT_ID = m.EVT_ID
INNER JOIN wp_posts v ON v.ID = ev.VNU_ID
INNER JOIN wp_esp_datetime dt ON dt.EVT_ID = p.ID
INNER JOIN wp_term_relationships tr ON p.ID = tr.object_id
INNER JOIN wp_term_taxonomy tt ON tt.term_taxonomy_id = tr.term_taxonomy_id
INNER JOIN wp_terms t ON tt.term_id = t.term_id
WHERE tt.taxonomy LIKE 'espresso_event_categories'
AND t.name <> 'delayed'
AND CAST(dt.DTT_reg_limit AS signed) - CAST(dt.DTT_sold AS signed) > 0
AND CURDATE() < CAST(dt.DTT_EVT_start AS DATE)
ORDER BY dt.DTT_EVT_start

But,I am missing one critical piece of data: the URL of the EE page that begins the event registration for that event.

This (still under construction) page on my website shows how I am using this information: http://www.connexions.world/a-taste-of-connexions/.

The button on the right end of each row says “Remind Me” or “Register Me”.

If it says “Register Me”, I want to open the corresponding registration page (JavaScript window.open…) but I don’t know where to get the URL for that page.


Tony

  • Support Staff

July 31, 2017 at 5:04 am

Hi there,

Quick question, can I ask why you are not using the EE model system to pull the details you need?

https://github.com/eventespresso/event-espresso-core/tree/master/docs/G–Model-System

Unless I’m missing something, the above SQL query does nothing different than you could do with the models fairly easily.

To answer your question, the EVent URL is not stored within the database, but the EE Events are custom post types (with additional data in our own tables as I’m sure your aware from the above) so you can pull the URL of an event the same way you would any standard post.

I’d use get_permalink(). Pass that the EE event post (I can’t see what your assigning the results to, but generally $post) or the ID of the post and it will return the permalink for the post/ID given (in this case the event).


rhj4

July 31, 2017 at 1:52 pm

You guys did it again! Great support that solved my problem.

Viewing 2 reply threads

The support post ‘Database schema question – where URL to 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