From 3df27308365d45d0ba7c4eead68f91feee54ca15 Mon Sep 17 00:00:00 2001 From: Steve Sutton Date: Wed, 15 Feb 2017 15:22:00 -0500 Subject: [PATCH] Adding hooks for calling the member contact save action. Action is added in the glm communicator plugin. These are set here to run the do_action calls. --- classes/data/dataContacts.php | 4 ++-- models/admin/contacts/index.php | 10 ++++++++-- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/classes/data/dataContacts.php b/classes/data/dataContacts.php index 83c3703..de0dc09 100644 --- a/classes/data/dataContacts.php +++ b/classes/data/dataContacts.php @@ -464,7 +464,7 @@ class GlmDataContacts extends GlmDataAbstract $table = GLM_MEMBERS_PLUGIN_DB_PREFIX.$this->config['ref_type_table'][$r['ref_type']['value']]; $dest = $this->wpdb->get_row("SELECT name FROM $table WHERE id = ".$r['ref_dest'].";"); - $r['ref_dest_name'] = $dest->name; + $r['ref_dest_name'] = ( isset( $dest ) && $dest->name ) ? $dest->name : ''; } @@ -694,4 +694,4 @@ class GlmDataContacts extends GlmDataAbstract } -?> \ No newline at end of file +?> diff --git a/models/admin/contacts/index.php b/models/admin/contacts/index.php index bc4fb4a..a505a3a 100644 --- a/models/admin/contacts/index.php +++ b/models/admin/contacts/index.php @@ -331,6 +331,9 @@ class GlmMembersAdmin_contacts_index extends GlmDataContacts // Get the updated user information $contactInfo = $this->editEntry($contactInfo['fieldData']['id']); + // do_action for glm-member-db-membercontactsave + do_action('glm-member-db-membercontactsave', $contactInfo); + // Save the contact ID $contactID = $contactInfo['fieldData']['id']; @@ -447,6 +450,9 @@ class GlmMembersAdmin_contacts_index extends GlmDataContacts // Get the wordpress user ID $wpUser = get_user_by('email', $contactInfo['fieldData']['email']); + // do_action for glm-member-db-membercontactsave + do_action('glm-member-db-membercontactsave', $contactInfo); + // Check for password changes and update Wordpress user if (trim($_REQUEST['password']) != '') { @@ -738,7 +744,7 @@ class GlmMembersAdmin_contacts_index extends GlmDataContacts if (apply_filters('glm_members_menu_members', $update)) { // And if there's contact member data - if ($_REQUEST['contactMembers'] && count($_REQUEST['contactMembers'])) { + if ( isset( $_REQUEST['contactMembers'] ) && count($_REQUEST['contactMembers'])) { // Update the contact members selection $contactMembersList = implode(',', $_REQUEST['contactMembers']); @@ -781,4 +787,4 @@ class GlmMembersAdmin_contacts_index extends GlmDataContacts } } -?> \ No newline at end of file +?> -- 2.17.1