Looking to see if integrating with Organic Groups is on the list or could make the list (possible)?

Basically when a user logs in, drupalchat would look at all the groups the user belongs to and then filter/create the Online User list based on all the members belonging to those groups.


Members fund testing for the Drupal project. Drupal Association Learn more


Equinger’s picture


Equinger’s picture

Here's a patch for this integration. Please review it. I also believe there was a problem that I addressed with User Relationship integration. Great module!

psychobyte’s picture


Apfel007’s picture

is this patch working? I didn't have time to test it- yet..

sjeandroz’s picture

I tried it and it seems to works! thanks it's a usefull patch!

darklrd’s picture

Thanks a lot! I will commit it in 6.x-2.x-dev.

@all - Btw, I had a query. Why are you not using 6.x-2.x?


thirdender’s picture

I got this to work against DrupalChat 7.x-1.0-beta10 and Organic Groups 7x-1.5. I had to modify the query to work with the new Organic Groups structure. Seems to work pretty good though. Also, I created the diff against a live module folder (not against git), so please let me know if that works or if I should re-roll the patch.

Also, I pulled most of the new query code from Code Karate: Drupal 7 getting all members of an Organic Group. However, I think I missed the user->status check. That shouldn't be important right? Because only logged in users will be shown…?

edutrul’s picture

thirdender: I didn't have success to reproduce your patch on tag 7.x-1.0-beta10 and also on current branch 7.x-1.x(tag: 7.x-1.0-beta15)


darklrd’s picture

thirdender, thank you for providing this patch, will review it and try to include it in current branch.

darklrd’s picture

edutrul, please feel free to submit a patch if you are working on this, thanks! :)

candelas’s picture

Issue summary: View changes

Is this patch working in the 7.x-1.4? Thanks

SocialNicheGuru’s picture

Status: Active » Needs review
SocialNicheGuru’s picture

Version: 6.x-1.x-dev » 7.x-1.4

Anything for OG 7.2?

When used with OG 7.2:

|Warning: Invalid argument supplied for foreach() in _drupalchat_buddylist() (line 936 of d7/modules/all/drupalchat/drupalchat.module).

PDOException: SQLSTATE[42000]: Syntax error or access violation: 1064 You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ')) AND (ogm.etid <> '1')' at line 1: SELECT DISTINCT ogm.etid AS etid#012FROM #012{og_membership} ogm#012WHERE (ogm.entity_type = :db_condition_placeholder_0) AND (ogm.gid IN ()) AND (ogm.etid <> :db_condition_placeholder_1) ; Array#012(#012 [:db_condition_placeholder_0] => user#012 [:db_condition_placeholder_1] => 1#012)#012 in _drupalchat_buddylist() (line 948 of /7/modules/all/drupalchat/drupalchat.module).

it brings the site down

sadashiv’s picture


I tried the patch with og 7.2 and it breaks. I modified few parts to work with og 7.2 and also added some additional features to create og's as chatrooms. Would be great if we all can test this and move this ahead.


sadashiv’s picture


Previous patch didn't worked for og as chatrooms. Fixed that issue in this patch.


sadashiv’s picture

Priority: Normal » Major
11.18 KB


Previous patch worked but showed wrong chatroom window heading. Have fixed that, this patch includes all changes.


SocialNicheGuru’s picture

is there nodejs integration for this?

jukka792’s picture


applied patch #16 and it seems to work nicely!
But my log file comes full of warnings:
"Warning: Invalid argument supplied for foreach() in function _drupalchat_buddylist() (line 982 drupalchat.module"

related to this:
+ // Create a flat array of user IDs
+ foreach ($results as $member) {
+ $users[] = $member->etid;

bhawanac’s picture

Will you please try this one?

SocialNicheGuru’s picture

Status: Needs review » Needs work

The newest patch in #19 is not applying at all.
I also am using the official version 7.x-1.8 version of the module

SocialNicheGuru’s picture

Updated patch for 7.x-2.1

SocialNicheGuru’s picture

Status: Needs work » Needs review
izmeez’s picture

Version: 7.x-1.4 » 7.x-2.x-dev

Just updating issue metadata for drupalchat version.

ledjerdemain’s picture

Hello everyone!

I tried to apply patch #21 and although it beautifully displays chatrooms as buddies in the buddylist, messages that are written in a Group chatbox do not appear to other users.

Note: It also limits the buddylist to those users who are actually group buddies (which is sweet!)

I m using Ajax and a latency of 120 and a refresh rate of 7 seconds. I'd greatly appreciate any light you might shed upon the matter.

SocialNicheGuru’s picture

Status: Needs review » Needs work

I can confirm #24

daniel.matcau’s picture

Did someone manage to integrate OG with iflychat option?

PS: #24 works for normal ajax option.

surendramohan’s picture

In case you are interested in ONLY embed chat format (not the popup one), you need not specify any user role/group while creating a new chat room. Just create a chat room with role as "all users" and then place the chat room into a page which can be accessed by users of only one OG. Similarly you may create a other rooms.

Alternatively, if you wish to use the OG chat in the popup format, you may use their REST API to specify organic group id while creating a chat room instead of user role. Please refer it's documentation here at https://iflychat.com/docs/rest/reference/create-new-chat-room. And then if the user has the specific OG, he/she would be able to access the room (in both popup and embed format). As discussed with the iFlyChat support, I got the knowledge that they are on working on this enhancement and is expected to be live during mid of March for the Enterprise plan accounts.

I hope this information proves to be productive.

Rahul Johnson’s picture

Is it possible in D8?