User and user groups

Is there an easy way - from the administrators view - to find out all user groups attached to a certain user? Do I have to fetch these data from secondary_group_ids in xf_user or from the table xf_user_group_relations?
And when the administrator wants to attach a new user group to a user, which of those tables has to be updated and how?
Is it also possible to get all users attached to a certain user group?


XenForo moderator
Staff member
View the member's profile in the ACP - the primary and secondary groups are shown (checked).

Do a user search against a user group to return all members.

Daniel Hood

Well-known member
sorry, I was not clear enough. I mean not on the GUI, but programmatically with PHP.
Look in the library/xenforo/model/user.php file. You want to avoid adding and removing users from groups with a simple query because of the way users are cached. You can also see some useful functions for getting users based on their group.