Add user automaticly to a group on registration
-
I’m using the “Groups” plugin for my WordPress site. I would like to automatically add a user to a group if their email ends with “@xxxx.com”.
Currently, I am trying to add all users to this group because I have not yet implemented the email check.
Here is the code I am using:
add_action( 'user_register', 'add_user_to_group', 10, 1 ); function add_user_to_group( $user_id ) { do_shortcode('[groups_join group='Prenium']'); }
However, it appears that this code is not functioning as expected. When I create an account, the user is not being added to the correct group. He is added to the “registerd” group, who is the default group.
I’m using WordPress version 6.3.1, and I’m certain that the group name is correct, and the shortcode seems to exist.
If anyone has any ideas about why this is not working, I would greatly appreciate your input.
Thank you for your assistance!
- The topic ‘Add user automaticly to a group on registration’ is closed to new replies.