douyan2680 2014-07-29 11:59
浏览 48
已采纳

Wordpress buddypress:缺少参数错误

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 );
  • 写回答

1条回答 默认 最新

  • dongyuxiao6295 2014-07-29 12:05
    关注

    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 );
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?