Group Member Table

Problem

What’s the schema for the group_member table?

Solution

The group_member table records the relationships between groups and users. Its fields are listed in Table 8-12. Queries to this table will only return data the current user is allowed to see (i.e., you can’t request groups that the current loggedinuser can’t see). More information about this table, including an up-to-date listing of fields, can be found at http://wiki.developers.facebook.com/index.php/Group_member_(FQL).

Table 8-12. group_member table fields

Name

Type

Index

Description

uid

int

User ID of this user.

gid

int

Group ID that this user belongs to.

positions

array

 

Any positions in the group that this user may occupy. If the user has no position in this group, positions will be null; otherwise, it will be an array listing each of her positions. Looks like the possible positions are ADMIN and OFFICER, but that’s not documented anywhere.

Note that only the fields marked as “Index” in this table can be used in an FQL query’s WHERE clause, but any of the fields can appear in the SELECT.

Discussion

If you’d rather use the API to access groups, try the Groups.get() and Groups.getMembers() methods.

Get Facebook Cookbook now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.