• Resolved B09

    (@basics09)


    Hello,
    we’ve just noticed a problem with the Media Manager Modal Window component.

    Assigning terms to a media asset from inside the MLA Modal Window will also assign these terms to the Post from which the MLA Modal Window was opened if the Post is supporting the terms taxonomy.

    Our expected behaviour would be that the selected term is only assigned to the media asset and not to both asset and post.

    Tested on a fresh WordPress 5.5.0 install with Media Library Assistant 2.84 and Classic Editor Plugin enabled.

    Steps to reproduce

    • Enable Taxonomy Support from MLA Settings (checked all boxes for Categories)
    • Create new Post
    • Create a new Category from the Categories Meta Box
    • Click on Add Media Button from the WYSIWYG Editor Window
    • Upload Media Item
    • Click on ?Categories <- Click to toggle? inside the Attachment Details part of the MLA Modal Window
    • Select the just created category and click Insert into Post Button

    The selected category will also be selected in the Categories Meta box of the Post.

    Also glad to help to come up with a fix for this issue.

    Best
    Ove

    • This topic was modified 4 years, 2 months ago by B09.
Viewing 7 replies - 1 through 7 (of 7 total)
  • Plugin Author David Lingren

    (@dglingren)

    Thanks for your report and for the excellent write up of the steps required to reproduce the issue; very helpful.

    I followed the steps you suggested on my own system. For your third step you wrote “Create a new Category from the Categories Meta Box“. I interpreted this to mean clicking on the “+ Add New Category” link in the Categories metabox in the “Edit Post” screen; is that right? If so, I observed that as soon as I entered the new term and click the “Add New Category” button at the bottom of the metabox the new term was assigned to the post and appeared as “checked” in the Categories list. This happened before opening the “Add Media” modal window.

    Have you tried adding the new term from within the Media Manager Modal Window itself?

    It looks like the term assignment is done by the Classic Editor code, not by MLA. If that does not agree with what happens on your system, any additional details you can provide will help me investigate further. I will leave this topic unresolved for now. Thanks for your interest in the plugin.

    Thread Starter B09

    (@basics09)

    Hello David,
    thanks for your quick reply and having a look at the issue reported.

    I followed the steps you suggested on my own system. For your third step you wrote “Create a new Category from the Categories Meta Box“. I interpreted this to mean clicking on the “+ Add New Category” link in the Categories metabox in the “Edit Post” screen; is that right?

    This step was just included to have more categories than the default ?Uncategorized? category.

    While creating a screen recording to better illustrate the issue, we noticed it’s not that straight forward to reproduce and we are currently struggling to reproduce it 100% after trying different approaches for one hour. It’s still happening though.

    In short: assigning an already created term from inside the MLA Modal Window to a media asset will sometimes also assign this term to the Post from which the MLA Modal Window has been opened.


    Assigning term to media asset from MLA Modal Window


    Term is also assigned to WordPress Post on which the MLA Modal was opened.

    Please note and this it where it gets a bit weird: when the issue was not reproduced on first image upload, we did upload another one and assigned the term. Sometimes saving the post and uploading/ assigning term from inside the MLA Window would cause the issue.

    • This reply was modified 4 years, 2 months ago by B09.
    • This reply was modified 4 years, 2 months ago by B09.
    • This reply was modified 4 years, 2 months ago by B09.
    Thread Starter B09

    (@basics09)

    Hello David,
    just wanted to follow up on this. I’ve created a video to better illustrate the problem.

    MLA Category Bug Video

    This is a serious bug that causes data corruption when an attachment category is also assigned to a post. In our case this over 1500 Posts which we are currently checking for wrong category assigments.

    Plugin Author David Lingren

    (@dglingren)

    Thank you for all your work to reproduce and document the problem. Thanks as well for taking the time to record and post the video; very helpful. I regret any corruption it has caused on your site.

    I have followed the steps in your video as carefully as I can and I cannot get the problem to occur on my system. I’d like to get a few more details so I can continue my investigation.

    First, I noticed that you are not running the latest WordPress update. I doubt this is an issue, but can you tell me what version was running when the video was produced?

    Second, I noticed something unusual in the video. At 25 seconds into the video you click “Add Media…” a second time, select the image and click the “click to toggle” link. You click the “MLA Category” twice (leaving it selected) and then click “Insert into post”. At 30 seconds in the display returns to the “Edit Post” screen, and the MLA Category box is already checked! This happens before you click “Update” for the post itself.

    My question is – if you abandon the Edit Post screen without saving/updating the post, is the MLA Category term still assigned to the post? If it is, that suggests a server-side issue. If not, it’s possible that a front-end JavaScript issue is checking the wrong box in the UI. Does that make sense?

    Once I know which WordPress version you are using I will try a fresh WordPress install with just the Classic Editor and MLA installed. Any other details you can provide will help guide me. Thank you for your patience, perseverance and understanding!

    Thread Starter B09

    (@basics09)

    Hello David,
    thanks again for your quick reply and looking into this issue. And also big thanks for making this plugin freely available and supporting it!

    The Video uses this versions:
    Wordpress 5.5.0
    Classic Editor 1.6
    Media Library Assistant 2.84

    I could reproduce this on macOS with Chrome 85.0.4183.102 and FF 80.0.1

    Second, I noticed something unusual in the video. At 25 seconds into the video you click “Add Media…” a second time, select the image and click the “click to toggle” link. You click the “MLA Category” twice (leaving it selected) and then click “Insert into post”.

    Yes, i could not reproduce the problem every time without doing it this way. First time clicking the Add Media button the MLA Modal window will be injected to the DOM the second time only the display: none css style is toggled.

    At 30 seconds in the display returns to the “Edit Post” screen, and the MLA Category box is already checked! This happens before you click “Update” for the post itself.

    Yes.

    My question is – if you abandon the Edit Post screen without saving/updating the post, is the MLA Category term still assigned to the post? If it is, that suggests a server-side issue. If not, it’s possible that a front-end JavaScript issue is checking the wrong box in the UI. Does that make sense?

    No, if the Post Edit screen is abandoned the category is not checked when revisted. So this should be a frontend issue.

    Any other details you can provide will help guide me.

    Looking at the MLA Category Checkbox HTML Elements i did notice that both, the WordPress Category List Modal and the MLA Category List use the same ID for the corresponding <input> element. In my case this is #in-category-4 for the “MLA Category” category.

    Best Ove

    Plugin Author David Lingren

    (@dglingren)

    Thanks for your update and the additional information.

    You wrote “the WordPress Category List Modal and the MLA Category List use the same ID for the corresponding <input> element.” This is the source of the problem, triggered by some code that “Synchronizes checkbox changes between “All …” and “Most Used” panels.” In particular, line 1775 in mla-media-modal-scripts.js.

    I have uploaded a new MLA Development Version dated 20200916 that corrects the problem. You can find step-by-step instructions for using the Development Version in this earlier topic:

    PHP Warning on media upload with Polylang

    It would be great if you could install the Development Version and let me know if it works for you. Thanks again for all you hard work in finding this MLA defect.

    I should note that this code was adapted from some WordPress code, and a similar problem exists there. I was able to follow a very odd sequence of steps and get a change in the post terms to be reflected in one of the Media Library items. The steps required make no sense so I don’t think the problem will be discovered in normal use.

    Thread Starter B09

    (@basics09)

    Thanks for taking the time to look into this and solving the issue. The Development Version Media Library Assistant v2.84 (20200916) did fix the issue both on the isolated WordPress test installation and the installation on which the issue first occured.

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘MLA Modal Window Terms assigned to Post’ is closed to new replies.