Re: Buddypress & CometChat Integration
`
$sql = (“(select DISTINCT “.TABLE_PREFIX.DB_USERTABLE.”.”.DB_USERTABLE_USERID.” userid, “.TABLE_PREFIX.DB_USERTABLE.”.”.DB_USERTABLE_NAME.” username, “.TABLE_PREFIX.DB_USERTABLE.”.”.DB_USERTABLE_LASTACTIVITY.” lastactivity, CONCAT(“.TABLE_PREFIX.DB_USERTABLE.”.”.DB_USERTABLE_USERID.”,’|’,”.TABLE_PREFIX.DB_USERTABLE.”.user_email) avatar, “.TABLE_PREFIX.DB_USERTABLE.”.user_nicename link, cometchat_status.message, cometchat_status.status from “.TABLE_PREFIX.”bp_friends join “.TABLE_PREFIX.DB_USERTABLE.” on “.TABLE_PREFIX.”bp_friends.friend_user_id = “.TABLE_PREFIX.DB_USERTABLE.”.”.DB_USERTABLE_USERID.” left join cometchat_status on “.TABLE_PREFIX.DB_USERTABLE.”.”.DB_USERTABLE_USERID.” = cometchat_status.userid where “.TABLE_PREFIX.”bp_friends.initiator_user_id = ‘”.mysql_real_escape_string($userid).”‘ and is_confirmed = 1)
union
(select DISTINCT “.TABLE_PREFIX.DB_USERTABLE.”.”.DB_USERTABLE_USERID.” userid, “.TABLE_PREFIX.DB_USERTABLE.”.”.DB_USERTABLE_NAME.” username, “.TABLE_PREFIX.DB_USERTABLE.”.”.DB_USERTABLE_LASTACTIVITY.” lastactivity, CONCAT(“.TABLE_PREFIX.DB_USERTABLE.”.”.DB_USERTABLE_USERID.”,’|’,”.TABLE_PREFIX.DB_USERTABLE.”.user_email) avatar, “.TABLE_PREFIX.DB_USERTABLE.”.user_nicename link, cometchat_status.message, cometchat_status.status from “.TABLE_PREFIX.”bp_friends join “.TABLE_PREFIX.DB_USERTABLE.” on “.TABLE_PREFIX.”bp_friends.initiator_user_id = “.TABLE_PREFIX.DB_USERTABLE.”.”.DB_USERTABLE_USERID.” left join cometchat_status on “.TABLE_PREFIX.DB_USERTABLE.”.”.DB_USERTABLE_USERID.” = cometchat_status.userid where “.TABLE_PREFIX.”bp_friends.friend_user_id = ‘”.mysql_real_escape_string($userid).”‘ and is_confirmed = 1 )
order by username asc
“);
if (defined(‘DISPLAY_ALL_USERS’) && DISPLAY_ALL_USERS == 1) {
$sql = (“select DISTINCT “.TABLE_PREFIX.DB_USERTABLE.”.”.DB_USERTABLE_USERID.” userid, “.TABLE_PREFIX.DB_USERTABLE.”.”.DB_USERTABLE_NAME.” username, “.TABLE_PREFIX.DB_USERTABLE.”.”.DB_USERTABLE_LASTACTIVITY.” lastactivity, CONCAT(“.TABLE_PREFIX.DB_USERTABLE.”.”.DB_USERTABLE_USERID.”,’|’,”.TABLE_PREFIX.DB_USERTABLE.”.user_email) avatar, “.TABLE_PREFIX.DB_USERTABLE.”.user_nicename link, cometchat_status.message, cometchat_status.status from “.TABLE_PREFIX.DB_USERTABLE.” left join cometchat_status on “.TABLE_PREFIX.DB_USERTABLE.”.”.DB_USERTABLE_USERID.” = cometchat_status.userid where “.TABLE_PREFIX.DB_USERTABLE.”.”.DB_USERTABLE_USERID.” ‘”.mysql_real_escape_string($userid).”‘ and (‘”.$time.”‘-“.TABLE_PREFIX.DB_USERTABLE.”.”.DB_USERTABLE_LASTACTIVITY.” < '".((ONLINE_TIMEOUT)*2)."') order by username asc");
}
return $sql;
`