HELP! I installed everything on my live site, and for some reason when I'm using this code:

<?php
//Get the UIDs of the users you want and store as an array.
$result = db_query("SELECT uid FROM {og_uid} WHERE nid = %d OR nid IN (SELECT group_nid FROM {og_ancestry} a LEFT JOIN {node} n ON a.nid = n.nid WHERE a.nid = %d AND n.type <> 'Group Node')", arg(1), arg(1));
while ($value = db_fetch_array($result)) {
  $user_list[] = $value['uid'];
}

$i = 0;
foreach ($user_list as $value) {
  $fbs_list = facebook_status_get_status($value);
  $list[$fbs_list[0]['status_time']] = $fbs_list[0];
  if (!empty($list[$fbs_list[0]['status_time']])) {
    $i++;
  }
  if ($i > 10) {
    break;
  }
}
krsort($list);
print facebook_status_list_render($list);
?>

At the bottom of the list is always "Anonymous 38 years ago." It never moves up, never dissapears.

What should I do?

Jon.

Comments

icecreamyou’s picture

Priority: Normal » Minor
Status: Active » Postponed (maintainer needs more info)

I copy-pasted your code onto a live site I have and it worked just fine. I don't know why you're having that problem, but it's probably not an issue with the module, especially if you're using custom code (even if I wrote it).

PHP version? SQL type/version? Any error messages in the log? Are there more than 10 people in the groups you're trying this in? Are there *any* people in the groups you're trying this in? Please don't tell me you allow anonymous users to use the status block.

Anyway, you can probably fix it by wrapping everything in the foreach() clause in if ($value) {}. If that doesn't work, wrap everything after the call to _get_status with if ($fbs_list[0]['status_time']) {}. (Technically, you don't have to include the if ($i > 10) {} stuff in there. You could also just move the !empty line up one, above the $list line.)

JonGirard-1’s picture

Status: Postponed (maintainer needs more info) » Fixed

"I copy-pasted your code onto a live site I have and it worked just fine."

--> Yea, I had it running on a local copy also, and never had that problem.

"Are there more than 10 people in the groups you're trying this in? Are there *any* people in the groups you're trying this in? Please don't tell me you allow anonymous users to use the status block."

--> Yes, Yes, Oh lord no.. is that even possible? :P

"Anyway, you can probably fix it by wrapping everything in the foreach() clause in if ($value) {}. If that doesn't work, wrap everything after the call to _get_status with if ($fbs_list[0]['status_time']) {}."

--> That worked brilliantly.. problem fixed! :)

Thanks,

Jon.

icecreamyou’s picture

Oh lord no.. is that even possible? :P

It's technically possible, but it will produce all kinds of crazy, unexpected results. Haha.

Glad everything's working for you.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for two weeks with no activity.