Is there a filter or action hook I could use to detect from a third-party plugin when a new user has been registered? It seems the hook WordPress uses: user_register will not work.
Detect New User Registration
I chose WP hooks since I know WP but I do not know S2. Do you know where i could find information about what “notifications” are?
Read at “s2Member -> API / Notifications”, there is lot of info.
1 Like
Ah, perfect, thank you I will have a look.
@krumch, yes, you’re right, set_user_role
does run on updates too, but you can deal with that with a conditional, like this:
function new_user_registered( $user_id, $new_role, $old_role ) {
$user_info = get_userdata( $user_id );
if ( empty( $old_role ) && $new_role == 's2member_level1' ) {
// do stuff
}
}
add_action( 'set_user_role', 'new_user_registered', 10, 3);
1 Like