Home Forums WoodMart support forum Bug with Login on Category pages

Bug with Login on Category pages

Viewing 11 posts - 1 through 11 (of 11 total)
  • Author
    Posts
  • #402226

    Thora
    Participant

    Hello,

    we recognized a bug on category pages.

    Normally, when logging in via the slide-in sidebar that is shown when clicking “Login / Register” in the header, the same page is shown after login. That works fine e.g. for homepage, regular pages and single product pages.

    But when logging in on product category pages, you are redirected to the shop homepage.

    E.g. you can see it on the official demo (but it is also happening on the current theme version):
    https://woodmart.xtemos.com/product-category/accessories/

    Of course, I don’t know your correct login credentials. But when trying a wrong login, I’m redirected to https://woodmart.xtemos.com/shop/ with the login error message on top of the products.

    This seems to happen for all category pages, e.g.:
    – On a portfolio category page I’m redirected to /portfolio/
    – On a blog category page I’m rediected to /blog/

    #402309

    Luke Nielsen
    Keymaster

    Hello,

    Unfortunately, at this time, we are not able to fix that.

    Again, we apologize for the inconvenience this may have caused you. Please let us know if there are any further questions or concerns you may have. We are always happy to assist.

    Kind Regards

    #402332

    Thora
    Participant

    Hello,

    is there an ETA for the fix?

    Because we aren’t using the shop homepage, there is a redirect from /shop/ to the homepage via “Redirection” plugin.

    The serious consequence:
    The login information can apparently not be transmitted or processed correctly.
    Therefore, only a simple forwarding to the homepage occurs – without login or an error message in case of an incorrect login.

    #402347

    Luke Nielsen
    Keymaster

    Hello,

    I don’t know what the “ETA” means but I can suggest a redirect to the “My Account” page with the help of the below code, paste it to the functions.php file in your child theme.

    add_filter( 'woodmart_my_account_side_login_form_redirect', function () {
    	return get_option( 'woocommerce_myaccount_page_id' );
    });

    Kind Regards

    #426259

    Thora
    Participant

    Hello,

    with ETA I meant the Estimated Time of Arrival for the fix.

    I don’t understand why it is not possible to implement the desired behavior on all pages, as it is already possible on the home page and product pages:
    I can login via Side Login, but am not redirected to another site.

    Behaviour with the Snippet above:

    • Login only possible on Homepage and account page.
    • All other WordPress pages, WooCommerce categories and also on product pages:
      There’s a browser warning at the login form, that login data is transfered unencrypted.
      After clicking „Login“, I’m redirected to http://0.0.0.21/

    Thank you in advance.

    #426728

    Luke Nielsen
    Keymaster

    Hello,

    Could you please describe in more detail what you are trying to achieve now with the redirect? It will help me to dig deeper and find a more personalized solutions.

    Looking forward to hearing back from you!

    Kind Regards

    #427424

    Thora
    Participant

    Hello,

    I described it in detail in my first posting, where you answered:

    Unfortunately, at this time, we are not able to fix that.

    I don’t understand why it’s so difficult to make login behave the same on category pages as on other pages.

    And now I recognized, when changing header login link from “sidebar” to “dropdown”, it works!
    But we favor the sidebar solution, because dropdown option doesn’t work on mobile.

    #427435

    Thora
    Participant

    Is there anything against the following change in the file
    /inc/integrations/woocommerce/template-tags.php
    in the section „Sidebar login form“?
    According to my random tests, everything seems to work.

    From:
    $redirect_url = apply_filters( 'woodmart_my_account_side_login_form_redirect', get_permalink( $page_id ) );
    to:
    $redirect_url = intval($wp_query->queried_object->ID);
    (source)

    Can you please check and confirm?
    Thank you in advance.

    #427680

    Luke Nielsen
    Keymaster

    Hello,

    If that code really works for you, then please remove all changes in the parent theme and paste the below code in the functions.php file in your child theme.

    add_filter( 'woodmart_my_account_side_login_form_redirect', 'wd_custom_login_form_redirect' );
    
    function wd_custom_login_form_redirect( $url ) {
    	global $wp_query;
    
    	return intval($wp_query->queried_object->ID);
    }

    Kind Regards

    #428197

    Thora
    Participant

    Hello,

    I have now first adopted the change I mentioned as a workaround. It would be nice to get this fixed in an update.
    Is there any need for the original code? I can’t see any benefit with that.

    Because the PHP snippet you mentioned for functions.php does not work correctly, so only a login on category pages is possible.

    On all other tested pages (homepage, regular pages, posts as WooCommerce products) I get a warning message in the login form that the data is transmitted unencrypted. A login is not possible via this, there is a redirection to different IPs like 0.2.58.215 or 0.2.33.227.

    #428398

    Luke Nielsen
    Keymaster

    Hello,

    In this case, if your own changes work better, use them instead of ours.

    Thanks for your time and have a great day.

    Kind Regards

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