From: laury Date: Fri, 12 Jan 2018 20:34:47 +0000 (-0500) Subject: Adding filters for contact info and member name and type X-Git-Tag: v2.10.23^2~23^2~4 X-Git-Url: http://cvs2.gaslightmedia.com/gitweb/?a=commitdiff_plain;h=db655018a2e91309d6f59c57fc76cb1afc008a56;p=WP-Plugins%2Fglm-member-db.git 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. --- 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;