• Resolved Imageascdev

    (@ascdev)


    Is there a function to get a list of all inherited users from all the sub-groups of a parent group?

    For exmple, if I retrieve the users from the parent group, it would like to include all users from all sub-groups?

Viewing 1 replies (of 1 total)
  • Plugin Author ImageKento

    (@proaktion)

    Here’s how you can get the child group IDs for a parent group:

    $child_group_ids = Groups_Group::get_groups( array( 'parent_id' => $parent_group_id ) );

    You would have to iterate over the children to get their children too until there are none to add.

    Once you have all groups, you can iterate on those and do $group->get_users() or $group->get_user_ids() on each to get the IDs of their members.

Viewing 1 replies (of 1 total)

The topic ‘Get a list of inherited users’ is closed to new replies.