Support » Plugin: Attachments » Attachments Plugin: Bug on simultaneous add & delete

  • Resolved kmwhite


    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!

Viewing 8 replies - 1 through 8 (of 8 total)
  • Plugin Author Jonathan Christopher


    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!

    Plugin Author Jonathan Christopher


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

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

    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
    Line 2

    followed by:

    Handlebars is not defined
    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!

    Plugin Author Jonathan Christopher


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

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

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

    Plugin Author Jonathan Christopher


    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.

    Makes sense to me. Thanks again!

Viewing 8 replies - 1 through 8 (of 8 total)
  • The topic ‘Attachments Plugin: Bug on simultaneous add & delete’ is closed to new replies.