Created
June 2, 2021 06:15
-
-
Save wbcomdev/0da93ebea1c1d9cbaff96b552a6feea1 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| ** | |
| * Added to group automattic after succesfull user registration. | |
| * | |
| * @param string $user_id Get a user id. | |
| */ | |
| function wbcom_add_user_to_group_after_registration( $user_id ) { | |
| if ( ! function_exists( 'groups_join_group' ) ) { | |
| return; | |
| } | |
| /* Change the group id here. */ | |
| $group_ids = array( 12 ); | |
| foreach ( $group_ids as $group_id ) { | |
| groups_join_group( $group_id, $user_id ); | |
| } | |
| } | |
| add_action( 'user_register', 'wbcom_add_user_to_group_after_registration' ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment