Search code examples
phpwordpressbuddypress

Wordpress buddypress: Missing argument error


I'm getting an missing argument error here. Any Idea?

function my_approve( $user_id, $user_login, $user_password, $user_email, $usermeta ) {
    // Send the email notification.
    wp_mail( $user_email, $user_login . ' Yay', 'you have been approved' );
}

add_action( 'bp_core_activated_user', 'my_approve', 10, 5 );

Solution

  • The function hooked to bp_core_activated_user should accept 3 args only: $user_id, $key and $user. So your code should look like this:

    function my_approve( $user_id, $key, $user ) {
        wp_mail( $user->user_email, $user->user_login . ' Yay', 'you have been approved' );
    }
    add_action( 'bp_core_activated_user', 'my_approve', 10, 3 );