• Resolved emilkonit

    (@emilkonit)


    Hello and thanks for this great plugin!

    We are experiencing an issue with the plugin though. It seems that when you create a list on a user and then log out and in with another user on the same computer, the list jumps from the first user to the one that logged in afterwards. I’ve tried a couple of things with this and it seems to only happen when you change user on the same computer. I asked my office colleague to log in with another user after I created a list and logged out and the lists don’t jump in those cases.

    This happens even when the browser cache is cleared, the owner of the list simply changes from one to another.

    Do you know why this happens? Can we fix this somehow?

    Thank you in advance!

    //Emil

Viewing 2 replies - 1 through 2 (of 2 total)
  • Thread Starter emilkonit

    (@emilkonit)

    It might have something to do with cookies and how it’s coded to use them.

    Thread Starter emilkonit

    (@emilkonit)

    Nevermind, we solved the issue. But if anyone else is experiencing the same problem:

    There are two functions in woocommerce-wishlists-api.php that are there for guests to be able to create lists and for lists to be created before registering. They connect lists with cookie sessions. We didn’t need these functions so we commented out the following lines:

    add_action( ‘wp_login’, ‘woocommerce_wishlists_logon’, 10, 2 );

    function woocommerce_wishlists_logon( $user_login, $user ) {
    global $wishlist_session_key;
    if ( $wishlist_session_key ) {
    $lists = WC_Wishlists_User::get_wishlists( false, $wishlist_session_key );
    if ( $lists && count( $lists ) ) {
    foreach ( $lists as $list ) {
    WC_Wishlists_Wishlist::update_owner( $list->id, $user->ID, $wishlist_session_key );
    }
    }
    }
    }

    add_action( ‘user_register’, ‘woocommerce_wishlists_register’, 10, 1 );

    function woocommerce_wishlists_register( $user_id ) {
    $wishlist_session_key = WC_Wishlists_User::get_wishlist_key();
    if ( $wishlist_session_key ) {
    $lists = WC_Wishlists_User::get_wishlists( false, $wishlist_session_key );
    if ( $lists && count( $lists ) ) {
    foreach ( $lists as $list ) {
    WC_Wishlists_Wishlist::update_owner( $list->id, $user_id, $wishlist_session_key );
    }
    }
    }
    }

    After this change it works well for us.

    Thank you anyway! 🙂

Viewing 2 replies - 1 through 2 (of 2 total)

The topic ‘Lists changes user on the same computer’ is closed to new replies.