Title: Hook
Last modified: October 28, 2017

---

# Hook

 *  Resolved [Will](https://wordpress.org/support/users/silvercats/)
 * (@silvercats)
 * [8 years, 5 months ago](https://wordpress.org/support/topic/hook-5/)
 * Is there a hook to add user ids to a user group? I am adding a newly registered
   user from wp-memebers to a user group in your forum plugin.
 * I am using this:
 *     ```
       // add new user\subscribers from wp-members to usergroup\members agaros forum plugin
       function rollins_add_forum_member_usergroup($fields) {	
       	$user_id=$fields['ID'];
       	$user_groups='Members';	
       	$AsgarosForumUserGroups = new AsgarosForumUserGroups;
           $AsgarosForumUserGroups->updateUserProfileFields($user_id, $user_groups);
       }
       add_filter('wpmem_post_register_data', 'rollins_add_forum_member_usergroup', 10, 2);
       ```
   

Viewing 1 replies (of 1 total)

 *  Plugin Author [Asgaros](https://wordpress.org/support/users/asgaros/)
 * (@asgaros)
 * [8 years, 5 months ago](https://wordpress.org/support/topic/hook-5/#post-9656475)
 * Hello
 * sorry for the late reply. Basically you can add new groups to a user with the
   following function:
 * `wp_set_object_terms($user_id, $user_groups, 'asgarosforum-usergroup', false);`
 * – `$user_id`: The ID of the user
    – `$user_groups`: An array with the IDs of 
   the user groups which you want to add to the user

Viewing 1 replies (of 1 total)

The topic ‘Hook’ is closed to new replies.

 * ![](https://ps.w.org/asgaros-forum/assets/icon-128x128.png?rev=1546717)
 * [Asgaros Forum](https://wordpress.org/plugins/asgaros-forum/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/asgaros-forum/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/asgaros-forum/)
 * [Active Topics](https://wordpress.org/support/plugin/asgaros-forum/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/asgaros-forum/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/asgaros-forum/reviews/)

## Tags

 * [asgaros](https://wordpress.org/support/topic-tag/asgaros/)
 * [forums](https://wordpress.org/support/topic-tag/forums/)
 * [integration](https://wordpress.org/support/topic-tag/integration/)

 * 1 reply
 * 2 participants
 * Last reply from: [Asgaros](https://wordpress.org/support/users/asgaros/)
 * Last activity: [8 years, 5 months ago](https://wordpress.org/support/topic/hook-5/#post-9656475)
 * Status: resolved