How to call a function after a group or user are created in Buddypress

I am trying to save user and group details in an Active Directory (LDAP) after buddypress save the details in mysql database.

Where can I place the code to save user and group details in LDAP. Can I call a function or are there any inbuilt function which can be used ?

Related posts

Leave a Reply

1 comment

  1. WordPress has a mechanism exactly for this: actions and filters.
    BuddyPress leverages actions/hooks to provide extension points through which you can customize it without modifying it’s sources.

    For what you need there’s a do_action( 'bp_core_activated_user', $user_id, $key, $user ) hook defined, so you’d just have to register add_action( 'bp_core_activated_user', 'bp_core_new_user_activity' ) that will be called with $user_id, $key, $user as parameters.

    If you search the documentation you’ll find most of the hooks. But ideally you’d look at the sources themselves to find appropriate ones.