Created
August 1, 2020 13:53
-
-
Save max-kk/679ea95e1d7836e96bde8f2dcecf76f8 to your computer and use it in GitHub Desktop.
LRM :: pilotpress redirect fix
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
add_action('pilotpress_post_user_login', function () { | |
$user_signon = wp_get_current_user(); | |
if ( !$user_signon ) { | |
return; | |
} | |
do_action('lrm/login_successful', $user_signon); | |
$message = lrm_setting('general/registration/reload_after_login', true) ? | |
lrm_setting('messages/login/success', true) : lrm_setting('messages/login/success_no_reload', true); | |
$action = lrm_setting('redirects/login/action'); | |
$redirect_url = LRM_Redirects_Manager::get_redirect( 'login', $user_signon->ID ); | |
wp_send_json_success(apply_filters('lrm/login/success_response', array( | |
'logged_in' => true, | |
'user_id' => $user_signon->ID, | |
'message' => $message, | |
'action' => $redirect_url ? 'redirect' : $action, | |
'redirect_url'=> $redirect_url, | |
))); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment