From: Steve Sutton Date: Mon, 18 Sep 2017 12:45:51 +0000 (-0400) Subject: Update for getting event detail page title. X-Git-Tag: v1.6.66^2~1 X-Git-Url: http://cvs2.gaslightmedia.com/gitweb/?a=commitdiff_plain;h=78987200331b2e165ab4e8351d401b1b13d8e6fa;p=WP-Plugins%2Fglm-member-db-events.git Update for getting event detail page title. This is for themes that have the title in separate area from the page content. --- diff --git a/setup/frontHooks.php b/setup/frontHooks.php index b9e1399..4e55154 100644 --- a/setup/frontHooks.php +++ b/setup/frontHooks.php @@ -113,6 +113,56 @@ add_filter('query_vars', function($vars) { return $vars; }); +function glm_get_event_name( $id = 0 ) { + global $wpdb; + if ( $id ) { + return $wpdb->get_var( + $wpdb->prepare( + "SELECT name + FROM ".GLM_MEMBERS_EVENTS_PLUGIN_DB_PREFIX . "events + WHERE id = %d", + $id + ) + ); + } + if ( !isset( $GLOBALS['glmDetailSlug'] ) || !$GLOBALS['glmDetailSlug'] ) { + return false; + } + return $wpdb->get_var( + $wpdb->prepare( + "SELECT name + FROM ".GLM_MEMBERS_EVENTS_PLUGIN_DB_PREFIX . "events + WHERE name_slug = %s", + $GLOBALS['glmDetailSlug'] + ) + ); +} + +function glm_is_event_detail( $id = 0 ) { + global $wpdb; + if ( $id ) { + return $wpdb->get_var( + $wpdb->prepare( + "SELECT name + FROM ".GLM_MEMBERS_EVENTS_PLUGIN_DB_PREFIX . "events + WHERE id = %d", + $id + ) + ); + } + if ( !isset( $GLOBALS['glmDetailSlug'] ) || !$GLOBALS['glmDetailSlug'] ) { + return false; + } + return $wpdb->get_var( + $wpdb->prepare( + "SELECT id + FROM ".GLM_MEMBERS_EVENTS_PLUGIN_DB_PREFIX . "events + WHERE name_slug = %s", + $GLOBALS['glmDetailSlug'] + ) + ); +} + if (isset($this->config['addOns']['glm-member-db'])) { // // Add content to member listing page - Get it from the existing package listing shortcode