Forums / Developer / Selecting all users in a group using the groupID.

Selecting all users in a group using the groupID.

Author Message

Clemens T

Thursday 01 September 2005 1:45:56 pm

Heya All!
I'm currently developing an extension which basically loops through a list of users that are grouped in a userGroup, now.. the way I get the ID of this user group is:

        $db =& eZDB::instance();

                    $groupName = "SuperUserList";
                    $groupQuery = "SELECT ezcontentobject_tree.node_id
                                       FROM ezcontentobject, ezcontentobject_tree
                                       WHERE ezcontentobject.name='$groupName'
                                       AND ezcontentobject.id=ezcontentobject_tree.contentobject_id";
                    $groupObject = $db->arrayQuery( $groupQuery );

The following question remains: How can I loop through the users of the groups with the ID's provided by the query above?

I know I'm close, I just don't know how...

Thanks, I'm stuck!

Clemens
ps: or can I use ::fetchList..? Can anyone explain to me what the best method is?

Kristof Coomans

Thursday 01 September 2005 10:55:50 pm

If all users you want to fetch are directly under that group, you can use <i>eZContentObjectTreeNode::fetchList</i>.

If they are further divided into groups under the group you found with the query, you can use <i>eZContentObjectTreeNode::subTree</i>.

independent eZ Publish developer and service provider | http://blog.coomanskristof.be | http://ezpedia.org

Clemens T

Friday 02 September 2005 3:34:23 am

Thanks a lot, I'll publish my code once it's done...(still under progress)