This topic has 3 replies, 3 voices, and was last updated 9 years by sharmstr.

  • Author
  • #31662
     PDMuniversal
    Participant

    I know that you can change KLEO to redirect you to the wordpress default dash or refresh the page through options. Is there a way to have it so once you login you are redirected to a different page. (trying to redirect to members page once you login)

    #31663
     Kieran
    Participant

    Haven’t tried this myself, but I have seen it recommended a few times as well as it being recently updated / highly rated on the WordPress directory.

    https://wordpress.org/plugins/peters-login-redirect/

    #31664
     PDMuniversal
    Participant

    Yeah i have that but its integrated with buddy press. But not integrated with the KLEO login. Hmm maybe ill look around some more and double check

    #31684
     sharmstr
    Moderator

    Put this in your childs function.php file and change ‘/activity’ to wherever you want them to go. Also, make sure you have ‘reload current page’ set in theme options -> Misc -> Login redirect for Popup

    COPY CODE
    
    function kleo_ajax_login()
    	{
    		// Check the nonce, if it fails the function will break
    		check_ajax_referer( 'kleo-ajax-login-nonce', 'security' );
    
    		// Nonce is checked, get the POST data and sign in user
    		$info = array();
    		$info['user_login'] = $_POST['log'];
    		$info['user_password'] = $_POST['pwd'];
    		$info['remember'] = (isset( $_POST['remember'] ) && $_POST['remember'] === true) ? true : false ;
    
    		$info = apply_filters('kleo_ajaxlogin_atts', $info);
    		
    		$user_signon = wp_signon( $info, false );
    		if ( is_wp_error( $user_signon ) ){
                $error_msg = $user_signon->get_error_message();
    			echo json_encode(array( 'loggedin' => false, 'message' => '<span class="wrong-response"><i class="icon icon-attention"></i> ' . $error_msg . '</span>' ));
                //echo json_encode(array( 'loggedin' => false, 'message' => '<span class="wrong-response"><i class="icon icon-attention"></i> ' . __( 'Wrong username or password. Please try again.', 'kleo_framework' ) . '</span>' ));
            } else {
                if ( sq_option( 'login_redirect' , 'default' ) == 'reload' ) {
                    $redirecturl = apply_filters( 'kleo_modal_login_redirect', '/activity/', '', $user_signon );
                }
                else {
                    $redirecturl = apply_filters( 'login_redirect', '', '', $user_signon );
                }
    
    			echo json_encode(array('loggedin'=>true, 'redirecturl' => $redirecturl, 'message'=> '<span class="good-response"><i class="icon icon-ok-circled"></i> ' . __( 'Login successful, redirecting...','kleo_framework' ) . '</span>' ));
    		}
    
    		die();
    	}
    
    Hi there!!! Help others from the community and mark any reply as solution if it solved your question. Mark as a solution

    This support site is not about custom work. If you need custom development please contact cornel@seventhqueen.com

Viewing 4 posts - 1 through 4 (of 4 total)

The topic ‘KLEO Login Redirect’ is closed to new replies.

Log in with your credentials

Forgot your details?