How to get users joined groups? Ossn_get_user_groups and getMyGroups

Kevin Ngo Posted in Component Development 10 years ago

Hi,

I'm trying to do something that requires me to grab the users joined groups.
I see the function ossn_get_user_groups which then calls getMyGroups. However that grabs both of the users owned and member of. Is there a way to distinct the two groups?

Replies
us Kevin Ngo Replied 10 years ago

Thank you for the response. I decided to filter out the groups with the condition

if(ossn_loggedin_user()->guid !== $group->owner_guid){
//Add to the array
}

So far it seems to work okay. If I run into any errors, I will use what you suggested. Once again, thank you.

Indonesian Arsalan Shah Replied 10 years ago

You can use following code to get groups of user that he is memberof (not his own group), please replace id with user id

https://gist.github.com/lianglee/cef412a6e7048a97b805