Support » Plugin: CMB2 » Error from async-upload.php – redirect 302 – with SSL enabled

Viewing 6 replies - 31 through 36 (of 36 total)
  • Hi,

    I think I solved this problem.

    If you are logging in on the front-end using your custom code (wp_signon) for login, and you try to upload an image on the front-end using media upload but it gives you an error of “An error occurred in the upload. Please try again later.”.

    However, if you login on the wp-login.php of the wordpress and try to upload images on the front-end and it gives you no problem.

    To solved it is just set the value of secure_cookie to true.
    Example: wp_signon( $credentials, true );

    References: https://codex.wordpress.org/Function_Reference/wp_signon

    How did you fix this issue? I’ve been having the same problem for the past few days and I can not figure out how to do it :/ Please can someone help me

    Plugin Author Michael Beckwith

    (@tw2113)

    The BenchPresser

    @maxologymarketing from the looks of it, Erwin above said that if you’re using the wp_signon() function, you need to pass a boolean true as the 2nd parameter.

    You can see more about this at https://codex.wordpress.org/Function_Reference/wp_signon

    HeY Michael I think I found the portion of the code that I have to change but I’m still new to backend stuff. I’m a frontend designer haha.

    What I found looks a little different $user_signon = wp_signon( $info, false );

    What should I change that to?

    Here is the full function

    if(!function_exists(‘search_and_go_elated_user_login’)){

    function search_and_go_elated_user_login() {

    if(empty($_POST) || !isset($_POST)) {
    eltdAjaxStatus(‘error’, esc_html__(‘All fields are empty’, ‘search-and-go’));
    } else {
    check_ajax_referer( ‘eltd-ajax-login-nonce’, ‘security’);
    $data = $_POST;

    $data_string = $data[‘post’];
    parse_str($data_string, $data_array);

    $info[‘user_login’] = $data_array[‘user_login’];
    $info[‘user_password’] = $data_array[‘user_password’];
    $redirect_uri = $data_array[‘redirect’];

    if(isset($info[‘remember’]) && $info[‘remember’] == ‘forever’) {
    $info[‘remember’] = true;
    }else {
    $info[‘remember’] = false;
    }
    $user_signon = wp_signon( $info, false );

    if ( is_wp_error($user_signon) ){
    eltdAjaxStatus(‘error’, esc_html__(‘Wrong username or password.’, ‘search-and-go’));
    } else {
    if ( $redirect_uri == ” ) {
    $redirect_uri = eltd_listing_get_dashboard_page_url();
    }
    eltdAjaxStatus(‘success’, esc_html__(‘Login successful, redirecting…’, ‘search-and-go’), $redirect_uri);
    }

    }
    wp_die();
    }
    add_action( ‘wp_ajax_nopriv_search_and_go_elated_user_login’, ‘search_and_go_elated_user_login’ );
    }

    Plugin Author Michael Beckwith

    (@tw2113)

    The BenchPresser

    Change that “false” to “true”

    $user_signon = wp_signon( $info, true );
    

    That’s what I thought but I just wanted to make sure.

    I had them deactive my SSL on my website because of this error so once it’s back up I will give that a try.

    Thanks for your time and help 🙂

Viewing 6 replies - 31 through 36 (of 36 total)
  • The topic ‘Error from async-upload.php – redirect 302 – with SSL enabled’ is closed to new replies.