Add redirect page after login/register

This commit is contained in:
Hoang Huu
2020-01-02 08:47:07 +07:00
parent 917e18e89f
commit 1c49a5b1d3
5 changed files with 55 additions and 14 deletions

View File

@@ -18,6 +18,8 @@ class Opalestate_User_Form_Handler {
add_action( 'wp_ajax_opalestate_login_form', [ $this, 'process_login' ] );
add_action( 'wp_ajax_opalestate_register_form', [ $this, 'process_register' ] );
add_filter( 'opalestate_signon_redirect_url', [ $this, 'login_redirect_url' ] );
add_filter( 'opalestate_register_redirect_url', [ $this, 'register_redirect_url' ] );
}
/**
@@ -322,6 +324,22 @@ class Opalestate_User_Form_Handler {
}
die();
}
public function login_redirect_url( $redirect ) {
if ( 'on' === opalestate_get_option( 'enable_login_redirect_to_dashboard', 'off' ) ) {
$redirect = opalestate_get_user_management_page_uri();
}
return $redirect;
}
public function register_redirect_url( $redirect ) {
if ( 'on' === opalestate_get_option( 'enable_register_redirect_to_dashboard', 'off' ) ) {
$redirect = opalestate_get_user_management_page_uri();
}
return $redirect;
}
}
new Opalestate_User_Form_Handler();