From db655018a2e91309d6f59c57fc76cb1afc008a56 Mon Sep 17 00:00:00 2001 From: laury Date: Fri, 12 Jan 2018 15:34:47 -0500 Subject: [PATCH] Adding filters for contact info and member name and type Added glma_get_logged_in_contact, glma_get_member_type, and glma_get_member_name in order for this information to be displayed more easily on the front end without exposing the config array (which also contains the user password). This was added in order to show this info in the MiGCSA header member box. --- setup/frontHooks.php | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/setup/frontHooks.php b/setup/frontHooks.php index a47d45b3..08733977 100644 --- a/setup/frontHooks.php +++ b/setup/frontHooks.php @@ -369,6 +369,26 @@ add_filter('glm_associate_phone_filter', function( $phone ){ // Passing phone to Plugin Support Function return glmMembersFilterPhone( $this->config, $phone ); }); +add_filter('glma_get_logged_in_contact', function() { + $contactUser = $this->config["loggedInUser"]["contactUser"]; + if ( !$contactUser ) { + $contactUser = false; + } + return $contactUser; +}); +add_filter('glma_get_member_type', function( $id ){ + // Passing phone to Plugin Support Function + global $wpdb; + $type = $wpdb->get_var( "SELECT name FROM ".GLM_MEMBERS_PLUGIN_DB_PREFIX . "member_type WHERE id = " + . "(SELECT member_type FROM ".GLM_MEMBERS_PLUGIN_DB_PREFIX . "members WHERE id = $id) " ); + return $type; +}); +add_filter('glma_get_member_name', function( $id ){ + // Passing phone to Plugin Support Function + global $wpdb; + $type = $wpdb->get_var( "SELECT name FROM ".GLM_MEMBERS_PLUGIN_DB_PREFIX . "members WHERE id = $id" ); + return $type; +}); function get_member_name( $id = 0 ) { global $wpdb; -- 2.17.1