注册用户并单击注册按钮后,将显示一条消息以确认同一页面上的电子邮件,但是该页面会立即重定向,并且用户没有足够的时间查看该消息。 我想在重定向操作之前设置一个延迟(例如5秒),然后再执行重定向操作。
if ( is_wp_error($user_id) ){
throw new Exception($user_id->get_error_message() , 401);
}
$data = get_userdata( $user_id );
$userdata = QA_Member::convert($data);
// generate new nonces
$msg = ae_get_option( 'user_confirm' ) ? __('You have registered an account successfully but are not able to join the discussions yet. Please confirm your email address first.', ET_DOMAIN) : __('You are registered and logged in successfully.', ET_DOMAIN) ;
$response = array(
'success' => true,
'code' => 200,
'msg' => $msg,
'data' => $userdata,
'redirect' => apply_filters( 'qa_filter_redirect_link_after_register', home_url() )
);
} catch (Exception $e) {
$response = array(
'success' => false,
'code' => $e->getCode(),
'msg' => $e->getMessage()
);
}
wp_send_json( $response );
}