function _drupalchat_buddylist in DrupalChat 7.2
Same name and namespace in other branches
- 6.2 drupalchat.module \_drupalchat_buddylist()
- 6 drupalchat.module \_drupalchat_buddylist()
- 7 drupalchat.module \_drupalchat_buddylist()
2 calls to _drupalchat_buddylist()
- drupalchat_poll in ./
drupalchat.module - Process and get messages
- _drupalchat_chat in ./
drupalchat.module
File
- ./
drupalchat.module, line 905 - Module code for DrupalChat.
Code
function _drupalchat_buddylist($uid) {
$users = array();
$drupalchat_rel = check_plain(variable_get('drupalchat_rel', DRUPALCHAT_REL_AUTH));
if ($drupalchat_rel == DRUPALCHAT_REL_UR && function_exists('user_relationships_load')) {
$relationships = user_relationships_load(array(
'name' => drupal_explode_tags(check_plain(variable_get('drupalchat_ur_name', 'friend'))),
'user' => $uid,
'approved' => 1,
), array(), TRUE);
foreach ($relationships as $rid => $relationship) {
$uid == $relationship->requester_id ? $users[] = $relationship->requestee_id : ($users[] = $relationship->requester_id);
}
}
elseif ($drupalchat_rel == DRUPALCHAT_REL_FF) {
$result = db_query("SELECT * FROM {flag_friend} WHERE uid = :uid OR friend_uid = :uid", array(
':uid' => $uid,
':friend_uid' => $uid,
));
foreach ($result as $friend) {
$uid == $friend->uid ? $users[] = $friend->friend_uid : ($users[] = $friend->uid);
}
}
return $users;
}