WordPress.org

Forums

Attachments
[resolved] Attachments Plugin: Bug on simultaneous add & delete (9 posts)

  1. kmwhite
    Member
    Posted 2 years ago #

    Hi there,

    Jonathan, if you read this: I really appreciate the amount of heavy lifting you've done on integrating the media library into a custom post field. Attachments is a fantastic plugin and a pleasure to use.

    Unfortunately, I've run into an issue when a user adds & deletes attachments simultaneously.

    My setup:

    • WP 3.4.1
    • TwentyEleven theme
    • No other plugins enabled
    • Attachments enabled for core posts only

    Test case / Steps to reproduce:

    • Add three attachments to a new post.
    • Save post.
    • Delete the middle attachment.
    • Add a new attachment. It will be appended to the end of the list.
    • Save post.

    Result: the attachment that precedes the newly attached one has been deleted as well.

    I did some research and think this may have to do with the reindexing that the Attachments javascript file does on delete, but I wasn't quickly able to come up with a patch. Any insight or direction around a fix I can implement quickly would be most appreciated, as I'm using this on a live client site. Thanks so much!

    http://wordpress.org/extend/plugins/attachments/

  2. Jonathan Christopher
    Member
    Plugin Author

    Posted 2 years ago #

    Thank you very much for the detailed report, I'll see what I can do to replicate and fix it as soon as I can!

  3. Jonathan Christopher
    Member
    Plugin Author

    Posted 2 years ago #

    Hi again, I've just committed version 1.6.2 which resolves the issue you've outlined. Thanks again!

  4. kmwhite
    Member
    Posted 2 years ago #

    Thank you so much for your prompt response! I'll check it out ASAP.

  5. kmwhite
    Member
    Posted 2 years ago #

    Hi Jonathan,

    The simultaneous add/delete is working now... at least in Chrome. However, in Firefox and Safari, attempts to add a file result in the red "Attached!" text, and then the modal abortively closes and no file is added to the attachments list.

    I'm seeing the following errors in the JavaScript console:

    return not in function
    http://[host]/wp-content/plugins/attachments/js/handlebars.js?ver=1.0.beta.6
    Line 2

    followed by:

    Handlebars is not defined
    http://[host]/wp-content/plugins/attachments/js/attachments.js?ver=1.6.2
    Line 88

    I think the hiccup in the first is causing the handlebars object to not be set up. No idea why this was working for me in Chrome, but the other two cases definitely fail.

    Additionally, in Chrome, I'm not getting a filename or thumbnail on add.

    My setup info remains the same.

    Thanks so much for your time on this!

  6. Jonathan Christopher
    Member
    Plugin Author

    Posted 2 years ago #

    Hi there, I updated to 1.6.2.1 this morning with a fix for Firefox, is that the version you're running?

  7. kmwhite
    Member
    Posted 2 years ago #

    Aha! Nope, I was out of date. Apologies.

    The attach action works now, and the title populates... still no thumbnail, however.

  8. Jonathan Christopher
    Member
    Plugin Author

    Posted 2 years ago #

    The thumbnail will (should) appear on save, it's something I've got to look into but shouldn't prevent the plugin from working as expected.

  9. kmwhite
    Member
    Posted 2 years ago #

    Makes sense to me. Thanks again!

Topic Closed

This topic has been closed to new replies.

About this Plugin

  • Attachments
  • Frequently Asked Questions
  • Support Threads
  • Reviews

About this Topic