Fix error from profile index
authorSteve Sutton <steve@gaslightmedia.com>
Mon, 3 Apr 2017 16:23:24 +0000 (12:23 -0400)
committerSteve Sutton <steve@gaslightmedia.com>
Mon, 3 Apr 2017 16:23:24 +0000 (12:23 -0400)
Getting an error when get_user_meta doesn't return anything.
Checking for $contactMemberList first before trying to add it to the
query.

models/admin/profile/index.php

index 24e6258..cef0d9e 100644 (file)
@@ -289,13 +289,15 @@ class GlmMembersAdmin_profile_index extends GlmDataContacts
 
             // Get contact's list of members they can manage
             $contactMembersList = get_user_meta($this->wpUserID, 'glmMembersContactMembers', true);
+            if ( $contactMembersList ) {
 
-            // Get a list of contact members with names and other basic info from the list of ids
-            $contactMembers = $this->Members->getIdName("ID in (".$contactMembersList.")");
+                // Get a list of contact members with names and other basic info from the list of ids
+                $contactMembers = $this->Members->getIdName("ID in (".$contactMembersList.")");
 
-            // Generate MD5 check string for each member ID
-            foreach ($contactMembers as $key => $value) {
-                $contactMembers[$key]['idCheck'] = md5(GLM_MEMBERS_CONTACTS_MD5_SECRET.$value['id']);
+                // Generate MD5 check string for each member ID
+                foreach ($contactMembers as $key => $value) {
+                    $contactMembers[$key]['idCheck'] = md5(GLM_MEMBERS_CONTACTS_MD5_SECRET.$value['id']);
+                }
             }
 
         }
@@ -316,4 +318,4 @@ class GlmMembersAdmin_profile_index extends GlmDataContacts
     }
 }
 
-?>
\ No newline at end of file
+?>