3

I'm the author of a Wordpress/Facebook plugin that for many years has given sites the ability to create WP communities by permitting/rejecting logins based on whether or not users are members of their private group on Facebook. Suddenly - in typical Facebook fashion - they broke it, and now state:

The user_groups permission is only approved for apps that let people use Facebook on platforms where Facebook is not already available. If you're building an app on Android and iOS, for example, you won't be approved for this permission. Web, Desktop and TV apps will also not be granted this permission.

Reference: https://developers.facebook.com/docs/facebook-login/permissions/v2.3

Previously, I was determining whether or not a user is a member of a group via the /group-id/members endpoint, and looking for the current user among the group's members list. This requires the now-impossible user_groups permission, and thus won't work. The /user/groups endpoint also requires user_groups, and won't work either. I found reference to another way using FQL (facebook graph api check if user is a member of a group using PHP) that supposedly didn't require user_groups, but they've killed FQL too.

So while I'm pretty sure I know the answer, I just wanted to reach out and see if there's any possible workaround that might help me avoid killing this extremely-popular feature: some other way to allow/disallow users based on membership to a group. Just looking for some outside-of-the-box thinking - or is it safe to consider Groups functionality completely lost and gone forever?

Thanks for any ideas you may have...

Community
  • 1
  • 1
J23
  • 3,061
  • 6
  • 41
  • 52

3 Answers3

4

I'm facing the same problem, and I've come to the conclusion you can imagine: there is no straight way to determine if a user is member of a certain group unless you have the user_group permission.

At the moment, the only workaround I've found is to store users' IDs in a database, together with a variable who tells me if he's a member of my group or not; I "manually" update this variable, periodically comparing my group's member list with the users database.

Remember that if you are administrator of a group, you can always get its member list without any permission (this is the code I use: $members = $facebook->api('/'.$userGroupId.'/members','GET');).

Once you have this list, you can use it to update the boolean variable "is_member" of your users' database.

Surely not the most elegant solution, but as far as I know there are not so many alternatives...

Anyway you could also follow the approach explained in the selected answer to this question: Facebook login for group members

Community
  • 1
  • 1
Hunter
  • 310
  • 1
  • 5
  • 15
  • That's actually a really good idea! Not ideal of course, but probably the best available given Facebook's new restrictions. Accepted. – J23 Jun 10 '15 at 16:36
  • Its not giving more than 5000 group members, so we can't rely on this solution, I have a group with 38,000 members, using pagination to get all group members but it still returns only 4995 group members, even the admins are missing :( – Waqas Ali Khan Jan 28 '16 at 10:50
  • we cannot fetch more than 5000 group members. – Waqas Ali Khan Jan 28 '16 at 13:44
  • [edge got deprecated](https://developers.facebook.com/docs/graph-api/reference/v3.0/group/members) so that endpoint/method can no longer be used either – Jonas D. Jun 15 '18 at 22:02
0

Basically the same answer that I used: download group members using the Graphic API to your database and then interrogate it from there. I am admin to a group of over 600 members, we don't get a rush of new members so it's easy to append the odd new ones in. It works but as has been said above, it's a crude method, its a shame FB has made this very difficult.

  • My previous remark was only ment as a comment, as you say David, as the real remedy would be for FB to mend their API to allow only closed group members to be able to login. – MikeAlan Oct 09 '17 at 16:15
0

As admin of a closed Facebook group and associated website, I had the same problem. I found one simple way around the problem of allowing only FB group members to log into the members section of the website but not the ideal solution, is to download all FB member IDs (no names, just IDs) into the sites database, it can then be queried once the 'Logon with Facebook' button has been clicked. If no match is found then no login. Simple! I have a FB group of 600+ members. The ID for any new member is entered manually. As I say, not the ideal solution but it does work.