Skip to:
Content
Pages
Categories
Search
Top
Bottom

Code for adding new members to groups automatically?


  • Bar Bar
    Participant

    @bar-bar

    Hi All,

    Is there anyone here having a code for adding new members to group automatically once they’ve signed up? I have tried this code

    //Automatically add new users to a group
    function automatic_group_membership( $user_id ) {

    if( !$user_id ) return false;
    groups_accept_invite( $user_id, < # group ID #> );
    }
    add_action( ‘bp_core_activated_user’, ‘automatic_group_membership’ );

    But it didn’t work. I’ve replaced the < # group ID #> with my group ID–> 1 in function.php in my child theme. That didn’t work. So I went to add it in bp-custom.php. No luck either.

    Would you mind helping me please?

    My WordPress Version is 4.3.1

    My Buddypress version is 2.3.3

    Thank you!

Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Code for adding new members to groups automatically?’ is closed to new replies.
Skip to toolbar