• Hi,
    I’m testing user Data Export/Erase requests with WordPress (4.9.10) Tool.
    It’s all ok, but, because I’ve added in function.php file a snippet to change default WordPress wp-login page with Woocommercce my-account page, it happens that the Confirmation URL on the confirmation email the user receives doesn’t work.
    It is https://mywebsite/my-account/?action=confirmaction&request_id=XXX_key=YYY instead of https://mywebsite/wp-login/?action=confirmaction&request_id=XXX_key=YYY

    My snippet to change login in function.php is

    function wp_change_login_url ( $login_url, $redirect, $force_reauth ) {
    return get_permalink( wc_get_page_id( ‘myaccount’ ) );
    }
    add_filter( ‘login_url’, ‘wp_change_login_url’, 10, 3);

    How can i solve this problem on email confirmation url without delete my snippet?

    Thanks

Viewing 3 replies - 1 through 3 (of 3 total)
  • Hello!

    All of the logic that processes those request confirmations is in the wp-login.php file itself, so unfortunately, there isn’t a good way to get that to happen on your alternate login page. One thing you could try, however, is adding a conditional to your filter so it only changes the login URL when its not generating a request email. Something like this, only functional:

    
    $request_actions = array( 'add_export_personal_data_request', 'add_remove_personal_data_request' );
    $current_action = filter_input( INPUT_POST, 'action' );
    
    if ( in_array( $current_action, $request_actions ) ) {
    	// return the original login URL
    } else {
    	// return your special login URL
    }
    

    I haven’t tested the above, so you’d definitely have to play around with it a bit.

    Thread Starter fadipet

    (@fadipet)

    Thanks for your answer.
    I implemented my login redirect function with the piece of code you indicated to me in
    that way but…no luck!

    function wp_change_login_url ( $login_url, $redirect, $force_reauth ) {
    $request_actions = array( ‘add_export_personal_data_request’, ‘add_remove_personal_data_request’ );
    $current_action = filter_input( INPUT_POST, ‘action’ );

    if ( in_array( $current_action, $request_actions ) ) {
    return;
    }
    else {
    return get_permalink( wc_get_page_id( ‘myaccount’ ) );
    }
    }
    add_filter( ‘login_url’, ‘wp_change_login_url’, 10, 3);

    Is there something wrong? I’m not a developer, sorry!
    Thanks again.

    Darn. If that doesn’t work, I don’t have any other ideas. One thing you could try is getting in touch with the WooCommerce support team and see if they have any other ideas about it.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Issue with Personal Data Export Confirmation URL’ is closed to new replies.