Possible fix if wrong user id is entered
[mailer.git] / inc / wrapper-functions.php
index 6cbb71e3b85b1379cd01b272b4f217fac496e9d9..665cb5ed50a7f3915492eaa3f9ee3408521c26d9 100644 (file)
@@ -770,11 +770,20 @@ function getUserData ($column) {
 
 // Geter for whole user data array
 function getUserDataArray () {
+       // Get user id
+       $uid = getCurrentUserId();
+
        // User id should not be zero
-       if (getCurrentUserId() < 1) debug_report_bug(__FUNCTION__.': User id is zero.');
+       if ($uid < 1) debug_report_bug(__FUNCTION__.': User id is zero.');
 
-       // Get the whole array
-       return $GLOBALS['user_data'][getCurrentUserId()];
+       // Get the whole array if found
+       if (isset($GLOBALS['user_data'][$uid])) {
+               // Found, so return it
+               return $GLOBALS['user_data'][$uid];
+       } else {
+               // Return empty array
+               return array();
+       }
 }
 
 // Checks if the user data is valid, this may indicate that the user has logged