登録が成功した直後にuser_register
フックが発生します。
add_action('user_register', 'my_theme_registration_do_stuff', 10, 1);
function my_theme_registration_do_stuff($user_id) {
// the only native way in WP to 'deactivate' a user is to set the role to 'none'. Read up on the implications of this and decide if this will suffice. If not, then you'll need to create some sort of user_meta to use for active/inactive user
$u = new WP_User($user_id);
// Remove role
$u->remove_role('subscriber'); //or whatever your site's default role is
}
これで、ユーザーは次のページに進みます。ユーザーがコードでSMSメッセージを取得したら
、彼/彼女はあなたのウェブサイト上のいくつかのフォームにコードを入力:
if(the code entered is correct){
$user = new WP_User(get_current_user_id());
$user->add_role('subscriber');
}
が有用である可能性があるhttps://developer.wordpress.org/reference/functions/get_user_by / – hisener