• Resolved panda

    (@alejorostata)


    I’ve used the below hook to redirect and add a notice on the sign-in form upon successful reset of password.

    function woocommerce_new_pass_redirect( $user ) {
       wc_add_notice( __( 'Your password has been changed successfully! Please login to continue.', 'woocommerce' ), 'success' );
       wp_redirect( home_url() . "/sign-in/?new-password-created=true" );
       exit;
    }
    add_action( 'woocommerce_customer_reset_password', 'woocommerce_new_pass_redirect' );

    Unfortunately, it doesn’t work in Microsoft Edge and Mozilla Firefox.

    Microsoft Edge Version
    Microsoft Edge 44.19041.1.0
    Microsoft EdgeHTML 18.19041

    Mozilla Firefox Version
    78.0.2 (64-bit)

    How can I fix this?

    • This topic was modified 4 years, 4 months ago by panda.
Viewing 6 replies - 1 through 6 (of 6 total)
  • Phil

    (@fullysupportedphil)

    Automattic Happiness Engineer

    These forums are intended for support with the default functionality of WooCommerce, so there aren’t as many developers on here as other options.

    For this type of coding questions, you’re more likely to get input by asking in the WooCommerce Developer Slack or Advanced WooCommerce Facebook group. As those communities are both frequented by developers (including our own).

    If you find something that you believe is a bug in WooCommerce, you can report that to the open-source project here:

    https://github.com/woocommerce/woocommerce/issues

    Thread Starter panda

    (@alejorostata)

    Which one of the codes I posted is not the default functionality of WooCoommerce?

    Your support is very poor.

    • This reply was modified 4 years, 4 months ago by panda.
    Phil

    (@fullysupportedphil)

    Automattic Happiness Engineer

    The default functionality of WooCommerce includes what you can do with WooCommerce from your site’s admin dashboard, or website front end. Without the use of additional plugins or coding.

    We offer support to free users here that covers that default functionality. You are still free to post questions related to customizing code here, I was simply trying to help point you to a better venue that may get more responses.

    You’re welcome to leave your question here though and see if a member of the community can help you.

    Thread Starter panda

    (@alejorostata)

    Those codes are actually in your docs, so I guess that is default functionality of WooCommerce, I just don’t know why I doesn’t work on Microsoft Edge and Mozilla Firefox, something’s not right. What I want is an answer as to why it doesn’t work and the possible solution.

    Anyway, the below codes are my current solution and it works but I still want to know your side.

    session_start();
    
    function csx_process_query() {
    	if ( isset( $_GET[ 'new-password-created' ] ) && $_GET[ 'new-password-created' ] === "true" ) {
    		if ( !empty( $_SESSION[ "new-password-created" ] ) && isset( $_SESSION[ "new-password-created" ] ) && $_SESSION[ "new-password-created" ] === "true" ) {
    			wc_add_notice( __( 'Password successfully changed!', 'woocommerce' ), 'success' );
    		}
    		unset( $_SESSION[ "new-password-created" ] );
    	}
    }
    add_action( 'init', 'csx_process_query' );
    
    function woocommerce_new_pass_redirect( $user ) {
       $_SESSION[ "new-password-created" ] = "true";
       wp_redirect( home_url() . "/sign-in/?new-password-created=true" );
       exit;
    }
    add_action( 'woocommerce_customer_reset_password', 'woocommerce_new_pass_redirect' );

    What I think is the message is being removed before the page load (only on Mozilla Firefox and Microsoft Edge).

    Best Regards

    Phil

    (@fullysupportedphil)

    Automattic Happiness Engineer

    Hey @alejorostata – I’m glad to hear you were able to find a solution.

    As I had mentioned above, our forum support does not cover code-related questions. Our forum support team are not developers and our developers do not use these forums as a support channel. We have dedicated channels for questions about code or customizing code.

    You’re welcome to share your question on the developer slack community mentioned above. Alternatively, if you think you’ve found a bug within the code of WooCommerce itself, you can add it as a new issue on the open-source WooCommerce project:

    https://github.com/woocommerce/woocommerce/issues/new/choose

    Thread Starter panda

    (@alejorostata)

    I wasn’t able to find a solution, I was able to solve the issue. Both of the links you’ve shared above don’t help at all. Even posting it as a bug on DSM doesn’t help.

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘wc_add_notice not working on Edge and Firefox’ is closed to new replies.