From: Steve Sutton Date: Mon, 8 Jul 2019 12:26:57 +0000 (-0400) Subject: Add filter for getting contact data when sending notifications. X-Git-Url: http://cvs2.gaslightmedia.com/gitweb/?a=commitdiff_plain;h=1d4ba2f097a962b9d4ac5db86469c883d263e9f1;p=WP-Plugins%2Fglm-member-db-contacts.git Add filter for getting contact data when sending notifications. Grabbing all contact data for the notices for billing. --- diff --git a/setup/commonHooks.php b/setup/commonHooks.php index f78b67f..123e64d 100644 --- a/setup/commonHooks.php +++ b/setup/commonHooks.php @@ -74,4 +74,21 @@ add_filter( 'glm_contact_update_user_role_by_ref_dest', function( $content, $ref } return $content; }, 10, 4); -?> +add_filter( 'glm-member-db-contacts-get-contact-data-by-refdest', function( $ref_dest ){ + require_once GLM_MEMBERS_CONTACTS_PLUGIN_CLASS_PATH . '/data/dataContacts.php'; + $contactData = new GlmDataContacts( $this->wpdb, $this->config ); + $contact_id = $this->wpdb->get_var( + $this->wpdb->prepare( + "SELECT id + FROM " . GLM_MEMBERS_CONTACTS_PLUGIN_DB_PREFIX . "contacts + WHERE ref_dest = %d", + $ref_dest + ) + ); + if ( $contact_id ) { + $contacts = $contactData->getEntry( $contact_id ); + } else { + $contacts = array(); + } + return $contacts; +} );