Created
April 25, 2019 15:58
-
-
Save landbryo/d46eb2e5d3bbffd896a45cc85cab4b64 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
/** | |
* Assign users to groups upon registration | |
*/ | |
function group_user_activate( $user_id ) { | |
if ( ! function_exists( 'groups_join_group' ) ) { | |
return; | |
} | |
if ( is_page( 'registration' ) || is_page( 'other-registration' ) ) { | |
$group_ids = array( | |
13, | |
7 | |
); | |
} else { | |
$group_ids = array( 13 ); | |
} | |
foreach ( $group_ids as $group_id ) { | |
groups_join_group( $group_id, $user_id ); | |
} | |
} | |
add_action( 'bp_core_activated_user', 'group_user_activate', 1 ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment