Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@landbryo
Created April 25, 2019 15:58
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save landbryo/d46eb2e5d3bbffd896a45cc85cab4b64 to your computer and use it in GitHub Desktop.
Save landbryo/d46eb2e5d3bbffd896a45cc85cab4b64 to your computer and use it in GitHub Desktop.
/**
* 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