Buddypress & CometChat Integration
-
Okay Guys and Gals – I need a little MySql & PHP help to get comet chat running.
I’ve just recently purchased CometChat and Inorder for it to work with a Buddypress install one must manually configure it.
I’ve got everything working except the friends list.. I don’t know how to tell it to call the online users.
Here are my instructions from Comet Chat:
Next, we modify getFriendsList() function.
The getFriendsList() function returns all the users’ details part of the Who’s Online list. This list need not necessarily be friends of the logged in user. It may simply be all online users instead. You can customize this to return any set of users.
The default configuration assumes that you have a table called friends with the following fields:
toid integer
fromid integer
All entries are assumed to be two-way i.e. if user A (id:1) and user B (id:2) are friends, then there will be two entries in the table:
id toid fromid
13 1 2
14 2 1
function getFriendsList($userid,$time) {
$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,
“.TABLE_PREFIX.DB_USERTABLE.”.”.DB_USERTABLE_USERID.” avatar, “.TABLE_PREFIX.DB_USERTABLE.”.”.DB_USERTABLE_USERID.” link,
cometchat_status.message, cometchat_status.status
from “.TABLE_PREFIX.”friends join “.TABLE_PREFIX.DB_USERTABLE.”
on “.TABLE_PREFIX.”friends.toid = “.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.”friends.fromid = ‘”.mysql_real_escape_string($userid).”‘
order by username asc”);
return $sql;
}
I don’t know what I need to change in that function so that it’s getting a list of users from buddypress…
Any ideas?
- The topic ‘Buddypress & CometChat Integration’ is closed to new replies.