Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Modifying an order with a downloadable product causes the download link to expire #1013

Closed
kenlaws opened this issue May 7, 2012 · 4 comments

Comments

@kenlaws
Copy link

kenlaws commented May 7, 2012

Seen using WooCommerce 1.5.4.

  1. User creates new order, pays, completes order including downloadable product.
  2. The user can download the product using the link provided via email or My Account.
  3. An admin goes to the order's page and clicks "Save Order" (the admin doesn't have to change anything.)
  4. The user will now see a message that their download has expired.
  5. A look in the db reveals that the access_expires field has changed from NULL to 1970-01-01.
@coenjacobs
Copy link
Contributor

I am unable to reproduce this. Is it possible that the install was upgraded from an old version? Sounds like some database tables didn't get updated properly.

Also, is this on an IIS machine?

@WesStraham
Copy link

I'm having a similar issue. Anytime an order is edited and the "Save Order" button is clicked the download becomes expired for the customer.

I have tested and reproduced the exact same error on multiple clean installs of WordPress, both locally and online.

So far the only work around I've came up with when I create or edit an order is to go ahead and make all of the adjustments I need to do, then I click "Save Order". Once I'm done, I scroll to the bottom, click "Revoke Access" and then re-add the item back (Grant Access), but without clicking "Save Order" after I re-add the item. For some reason it works when its done that way, even though this isn't the way it was intended I'm sure.

What do you think it could be?

@kenlaws
Copy link
Author

kenlaws commented May 9, 2012

I fixed this in 1.5.4 by changing the conditional part of line 271 in writepanel-order_downloads.php from...

array_key_exists($i, $access_expires)

... to ...

(array_key_exists($i, $access_expires) && $access_expires[$i] != "")

I believe the problem was that the access_expires field being passed in from the order page was set to "" instead of null, thus causing it to be converted into 1970-01-01.

@coenjacobs
Copy link
Contributor

Thanks @kenlaws!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants