// Get the event name for use in the page title
global $wpdb;
$eventData = $wpdb->get_row(
- "SELECT name,intro
+ "SELECT name,intro,status
FROM ".GLM_MEMBERS_EVENTS_PLUGIN_DB_PREFIX . "events
- WHERE name_slug = '".$GLOBALS['glmDetailSlug']."'",
+ WHERE name_slug = '".$GLOBALS['glmDetailSlug']."'
+ AND status = " . $this->config['status_numb']['Active'] . "",
ARRAY_A
);
+ if ( ! $eventData ) {
+ // If the eventData is not found then create 404
+ function glm_throw_404(){
+ global $wp_query;
+ $wp_query->set_404();
+ status_header( 404 );
+ nocache_headers();
+ add_filter('wp_title', function($title) {
+ return 'Error 404 - Not Found!';
+ }, 99, 1);
+ $template404 = get_404_template();
+ if ( $template404 ) {
+ require $template404;
+ }
+ exit;
+ }
+ add_action('wp', 'glm_throw_404');
+ }
$GLOBALS['glmEventName'] = $eventData['name'];
$GLOBALS['glmEventIntro'] = $eventData['intro'];
10,
2
);
-
+
// Add content to member detail page - Get it from the existing event listing shortcode
// Unlike the filters above this one is not listed by default on the member detail page
// but can be applied to custom member db view files if they remove any "descriptionAfter"