Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sbrajesh/9e79cc4b3f5675086bdd302c8251f651 to your computer and use it in GitHub Desktop.
Save sbrajesh/9e79cc4b3f5675086bdd302c8251f651 to your computer and use it in GitHub Desktop.
Auto join user to current group when using BuddyPress Ajax Registration plugin.
/**
* Auto join user to current group when using BuddyPress Ajax Registration plugin.
*
* @param int $user_id user id.
*/
function buddydev_auto_join_current_group_on_activation( $user_id ) {
if ( bp_is_group() ) {
groups_join_group( groups_get_current_group()->id, $user_id );
}
}
add_action( 'bp_core_activated_user', 'buddydev_auto_join_current_group_on_activation' );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment