Adding hooks for calling the member contact save action. feature/communicatorHooks
authorSteve Sutton <steve@gaslightmedia.com>
Wed, 15 Feb 2017 20:22:00 +0000 (15:22 -0500)
committerSteve Sutton <steve@gaslightmedia.com>
Wed, 15 Feb 2017 20:22:00 +0000 (15:22 -0500)
Action is added in the glm communicator plugin.
These are set here to run the do_action calls.

classes/data/dataContacts.php
models/admin/contacts/index.php

index 83c3703..de0dc09 100644 (file)
@@ -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
+?>
index bc4fb4a..a505a3a 100644 (file)
@@ -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
+?>