Forums

Home » Liferay Portal » English » 3. Development

Combination View Flat View Tree View
Threads [ Previous | Next ]
toggle
Brian Scott Schupbach
Automatic Friend association when users are in the same organization
May 24, 2012 12:48 PM
Answer

Brian Scott Schupbach

Rank: Expert

Posts: 331

Join Date: October 23, 2008

Recent Posts

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
Anil T
RE: Automatic Friend association when users are in the same organization
May 25, 2012 12:15 AM
Answer

Anil T

Rank: Regular Member

Posts: 194

Join Date: January 14, 2012

Recent Posts

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);
Brian Scott Schupbach
RE: Automatic Friend association when users are in the same organization
May 25, 2012 7:11 AM
Answer

Brian Scott Schupbach

Rank: Expert

Posts: 331

Join Date: October 23, 2008

Recent Posts

Thanks..I appreciate that. That's kind of a bummer that each user of an organization would need to loop through every other user.