Add new members to BuddyPress groups automatically

If you are looking to add new members to one or more BuddyPress groups automatically, this post will help you.

You can use the following code and put it in your bp-custom.php

All you need to do is change the $group_ids with your own group ids. if you are looking to find out the BuddyPress group ids, you may want to check this tutorial.

Also, this works nicely with our BuddyPress Ajax Registration Plugin as well as BuddyPress Auto Activate Auto Login plugin.

If you are looking for more, Please take a look at BuddyPress Auto Join Groups,  which allows you to automate group joining based on profile data or member types.

Hope the code helps some of you. have fun building a great social network with BuddyPress!

7 Responses to Add new members to BuddyPress groups automatically

  • Awesome!
    What about adding a new member to a group based on their member type (or a user role)?

    EX: User registers on a site and joins as a Sports Fan (Member type) and upon account activation user is automatically added to Sports Fans (Group).

    Would be great on-boarding when working with several member types and groups. (and even group types).

    • Thank you.
      That's a good idea and can be easily done. The only requirement will be assigning member type to the user before we wpply the above code.

      Are you using our BuddyPress Members Types plugin? If yes, I can update the post to show an example.


      • Thanks, Brajeesh!

        On one project I used / use the Member Types plugin and on another I added them manually. (use the select member type as profile field one as well)

      • Hi Brajesh and thanks in advance for your help.

        I have purchased the BuddyPress Member Types plugin and would love to see this post updated with this example. My needs are similar to Crossifixio Delante's.

        1. Assign BuddyPress Group based on Member Type

        2. Assign BuddyPress Group based on State – a text xprofile field required during the registration

        I look forward to seeing if anyone has worked out a solid solution for this. Thanks!

  • Hi Brajesh! Just saw the Member Types Pro plugin. Is this a newer one??

    I've been working on non-BP work for awhile so I haven't been deep in BP the last couple months, but the overview of the plugin sounds ideal.

    Seems to do several things that I've looked for in a single codebase for awhile.

    Hopefully people realize how powerful a set of features that plugin provides for building dynamic communities.

    Great job!


    • Thank you.
      Yes, It is a new one and I have tried to make it as feature rich and useful as possible.

      Thank you for the kind words, I am glad you liked it and I am sure It will help a lot to others too 🙂