In my test setup I have 2 buddies online, but the buddy list popup shows anonymous users as buddies with offline status, and notices show up:

Notice: Trying to get property of non-object in nodejs_buddylist_block_content() (line 97 of /home/devel/500/www/drupalnodejs/sites/all/modules/nodejs/nodejs_buddylist/nodejs_buddylist.module).
Notice: Trying to get property of non-object in nodejs_buddylist_block_content() (line 98 of /home/devel/500/www/drupalnodejs/sites/all/modules/nodejs/nodejs_buddylist/nodejs_buddylist.module).
Notice: Trying to get property of non-object in theme_nodejs_buddylist_chat_button() (line 124 of /home/devel/500/www/drupalnodejs/sites/all/modules/nodejs/nodejs_buddylist/nodejs_buddylist.module).

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

pedrop created an issue. See original summary.

pedrop’s picture

This simple patch solved the problem for me.

pedrop’s picture

Version: 7.x-1.11 » 7.x-1.x-dev
Status: Patch (to be ported) » Needs review
Anonymous’s picture

Status: Needs review » Needs work

thanks for the patch.

however, there seems to be something else happening. nodejs_buddylist_user_list($account) just wraps flag_friend_get_friends, which does this:

function flag_friend_get_friends($uid, $reset = NULL) {
  static $cache = array();

  if (!isset($cache[$uid]) || $reset) {
    $cache[$uid] = array();
    $friends = flag_friend_get_friends_query($uid);
    foreach ($friends as $friend) {
      $cache[$uid][$friend] = (array) user_load($friend);
    }
  }
  return $cache[$uid];
}

not sure why the user_load() would succeed in nodejs_buddylist_block_content() but not in flag_friend_get_friends(). maybe we could still add something like this code, but i'm hesitant until i understand why the flag_friend code is not loading the user objects.