From 0136e912d79059313af7ec8bae8c1cb1cd503b7b Mon Sep 17 00:00:00 2001 From: Steve Sutton Date: Tue, 9 Jul 2019 08:15:24 -0400 Subject: [PATCH] Add filter for billing This filter is used in billing to get contact data for notices. --- setup/commonHooks.php | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/setup/commonHooks.php b/setup/commonHooks.php index b3194ec..fefb19e 100755 --- a/setup/commonHooks.php +++ b/setup/commonHooks.php @@ -81,4 +81,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; +} ); -- 2.17.1