Foren

Automatic Friend association when users are in the same organization

thumbnail
Brian Scott Schupbach, geändert vor 11 Jahren.

Automatic Friend association when users are in the same organization

Expert Beiträge: 329 Beitrittsdatum: 23.10.08 Neueste Beiträge
Is there a way to have users be automatically associated as "friends" without the need to send friend requests? It seems the chat functionality works this way but not any of the socialnetworking portlets.

Thanks,

Brian
thumbnail
Anil T, geändert vor 11 Jahren.

RE: Automatic Friend association when users are in the same organization

Expert Beiträge: 313 Beitrittsdatum: 14.01.12 Neueste Beiträge
Hi,
You can get it through SocialRelationLocalServiceUtil class. First get all users from organization and use SocialRelationLocalServiceUtil.hasRelation(userId1,userId2,type) to check whether the user in friends or not. If he is not a friend then add him to socialrelation table through SocialRelationLocalServiceUtil.addRelation(userId1,userid2,type);
thumbnail
Brian Scott Schupbach, geändert vor 11 Jahren.

RE: Automatic Friend association when users are in the same organization

Expert Beiträge: 329 Beitrittsdatum: 23.10.08 Neueste Beiträge
Thanks..I appreciate that. That's kind of a bummer that each user of an organization would need to loop through every other user.