title: php notice (trying to get property of non-object) error
body: <p>So, I have following php for wp:</p>
  
  <pre><code> $usersNames = array();
   foreach ($userIDs as $userId) {
              $userInfo = get_userdata($userId);
              $usersNames[] = $userInfo-&gt;display_name; //this one                                     
          } 
  </code></pre>
  
  <p>I am getting an error for <code>$usersNames</code>.</p>
  
  <pre><code>"PHP Notice:  Trying to get property of non-object in /functions.php on line"
  </code></pre>
  
  <p>What is going on?</p>
  
  <p>Any suggestions?</p>
  
  <p>Thanks</p>
  
  <p><strong>EDIT:</strong></p>
  
  <p>So, for <code>$userIDs</code>, I have an array of user ids. Then I am trying to get user display name etc for individual ids.</p>