Make sure you have read this first: https://codex.wordpress.org/Plugin_API
Here you can find a listing of most (all?) of the current WordPress hooks: https://codex.wordpress.org/Plugin_API/Action_Reference
Here you can find a listing of BuddyPress hooks, although this is out of date:
https://codex.buddypress.org/developer-docs/action-reference/
As far as your particular project, you probably can find the proper hook to tie into by searching the register.php file in the BP default theme. There are many hooks you can use.
Also, if you want to learn more about the current BuddyPress hooks, I would recommend searching for all “do_action” and “apply_filter” calls within BuddyPress.
I had read those pages before, and I was struggling with the out of date buddypress hooks. I wanted to confirm that the “do_action” call is the hook ‘enabler’ sort of speak. Would I be correct if I ventured the variable in the do_action function call would be the actual hook name that I could hook into?
For example:
do_action( ‘bp_core_something’)
The ‘bp_core_something’ is the hook I could add_action to?
Yes.
function do_something_cool () {
// Code to do something cool
}
add_action( 'bp_core_something', 'do_something_cool' );
You could even add your own custom hook so that others could then modify the outcome of your do_something_cool function. So:
function do_something_cool () {
do_action( 'before_something_cool' );
// Code to do something cool
do_action( 'after_something_cool' );
}
add_action( 'bp_core_something', 'do_something_cool' );
Thanks for the help Jeff!
I was able to get it all sorted out! Yeah! Now when users register they will automatically be added to the selected groups!
I am currently using WPMU, so I am using a WPMU Hook. Is there an easy way to register actions using either WP or WPMU Hooks so there wouldn’t need a second version of the plugin for single user wordpress.
The hook I am currently using is wpmu_new_user and I believe the single user equivalent is user_register. Is there a global value available to do something like this…
if ( $wpmu ) {
add_action ('wpmu_new_user', 'auto_join_new_user');
} else {
add_action('user_register', 'auto_join_new_user');
}
@twodeuces I’m trying to make it so when a user clicks “Join group” they are taking to the group’s page, instead of left on the directory. could you provide me with some clues on how to do that?