Title: API function which checks for parent group?
Last modified: August 31, 2016

---

# API function which checks for parent group?

 *  Resolved [johnmontfx](https://wordpress.org/support/users/johnmontfx/)
 * (@johnmontfx)
 * [10 years, 3 months ago](https://wordpress.org/support/topic/api-function-which-checks-for-parent-group/)
 * I have my groups tree set up as follows:
 * ParentGroup
    -ChildGroup1 -ChildGroup2
 * To make things more straightforward in coding, I want to be able to check if 
   members are in a parent group and then have more granular capabilities in the
   child groups. However, the following code doesn’t work for users who are in the
   child groups:
 *     ```
       $is_forum_member = 'false';
       $group = Groups_Group::read_by_name( 'ParentGroup' ) ;
       $is_forum_member = Groups_User_Group::read( get_current_user_id() , $group->group_id );
       ```
   
 * **$is_forum_member** returns false for users who are in either ChildGroup1 or
   ChildGroup2
 * Is there a function where this will work? I can’t seem to find it in the API 
   docs.
 * [https://wordpress.org/plugins/groups/](https://wordpress.org/plugins/groups/)

Viewing 1 replies (of 1 total)

 *  Plugin Author [Kento](https://wordpress.org/support/users/proaktion/)
 * (@proaktion)
 * [10 years, 3 months ago](https://wordpress.org/support/topic/api-function-which-checks-for-parent-group/#post-7122975)
 * `$u = new Groups_User( get_current_user_id() );`
 * `$u->group_ids_deep` provides all group ids of those that the user belongs to
   `
   $->groups_deep` provides the Groups_Group objects

Viewing 1 replies (of 1 total)

The topic ‘API function which checks for parent group?’ is closed to new replies.

 * ![](https://ps.w.org/groups/assets/icon-256x256.png?rev=983146)
 * [Groups](https://wordpress.org/plugins/groups/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/groups/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/groups/)
 * [Active Topics](https://wordpress.org/support/plugin/groups/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/groups/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/groups/reviews/)

 * 1 reply
 * 2 participants
 * Last reply from: [Kento](https://wordpress.org/support/users/proaktion/)
 * Last activity: [10 years, 3 months ago](https://wordpress.org/support/topic/api-function-which-checks-for-parent-group/#post-7122975)
 * Status: resolved