WordPress.org

Ready to get started?Download WordPress

Forums

Media Library Assistant
[resolved] Bad Parent / Orphan possibly wrong? (23 posts)

  1. Alexander S. Kunz
    Member
    Posted 1 year ago #

    Hello,

    first of all, thanks a lot for the plugin - that's pretty close to what I was looking for for quite a while. :) I've yet to adopt the system and play with it a little bit to fully embrace it on my site, but it appears to be the most intuitive approach to what I want to do anyway. :)

    Now, on to the problem. When browsing the MLA table view, I noticed that there's a fair number of items marked with the "Orphan/Bad Parent" note. However, browsing the normal Media Library view, the items are all correctly attached to a post or page (and are in fact used on that page). Is this a known bug/limitation?

    Best
    Alexander.

    http://wordpress.org/extend/plugins/media-library-assistant/

  2. David Lingren
    Member
    Plugin Author

    Posted 1 year ago #

    Alexander,

    Thanks for using the plugin and for your kind words. If there are other features you'd like to see, let me know.

    Now, on to the problem. Your message is the first report I've had about problems with the where-used reporting.

    The "Bad Parent" notation means that the item is attached (i.e., the post_parent database field is not zero), but either the parent ID is for a post or page which has been deleted or the parent ID exists but the attachment is not used as the Featured Image and is not inserted in the body of the post/page. There are some problems with this field; for example, if you change the "Featured Image" for a post the post_parent doesn't always get updated. It's quite possible that there's some way to use an item that I am not yet searching for.

    The "Orphan" notation means that my search did not find any post or page which uses the item as a Featured Image or has the item inserted in the body of the post/page.

    I'll need more information to reproduce the problem and fix it. Can you tell me what's in the "Featured in" and "Inserted in" columns of the MLA listing for the problem items? What's in the ID/Parent column?

    For one of the problem items, how is it used in the post/page that should be its parent?

    The best way to help me look into this would be to send me some screen shots of the problem(s), e.g., the MLA listing page and the HTML view of the post/page content where the item is used. If you're willing to do that or you have other information you don't want to post here, go to the Our Story/Contact Us (http://fairtradejudaica.org/our-story/contact-us/) page at fairtradejudaica.org and give me your e-mail address. I'll send you my e-mail address and we can exchange more information.

    Thanks again for using the Media Library Assistant and for your pateince while I work on this issue.

    David

  3. Alexander S. Kunz
    Member
    Posted 1 year ago #

    Hello David,

    thank you for the swift response!

    The "Bad Parent" notation means that the item is attached (i.e., the post_parent database field is not zero), but either the parent ID is for a post or page which has been deleted or the parent ID exists but the attachment is not used as the Featured Image and is not inserted in the body of the post/page.

    Hmmmm... before I go into the details and look up the required information: if I understand this correctly, this does not cover the usage via a [gallery] shortcode, or does it?

    I do not insert the image into the post directly, and none of them is used as a featured image either. The images are attached to the post, and all I do is to use the gallery shortcode (WP standard gallery) to show the images.

    One or more of these images may be inserted into a different post and/or featured in a different post (because I'm using a "portfolio" custom post type, which I'd be hoping to replace with vanilla WP attachment pages and your plugin).

  4. David Lingren
    Member
    Plugin Author

    Posted 1 year ago #

    Aha! You’ve identified the problem – I don’t check for the [gallery] shortcode. You’d think after all the work I put into adding the [mla_gallery] shortcode to version .50 this would have been obvious to me.

    It would be helpful to me if you can send some examples of how you use [gallery], i.e., do you use any of the parameters it supports to modify the images you include?

    In any case I will start thinking of how to address this issue. The easiest thing to do would be to assume that any post/page with a [gallery] (or [mla_gallery]) is a valid parent for all attachments that use it as a post_parent. That wouldn't always be accurate, and with the additional parameters supported by [mla_gallery] it would often be wrong.

    Another approach would be to actually run the shortcode and see which posts/pages it returns. That would be more accurate but might require a lot of database access. Perhaps I'll make that an optional feature controlled by the Settings page.

    I welcome any further ideas on this topic. Thanks again for following up on this and for your feedback.

  5. Alexander S. Kunz
    Member
    Posted 1 year ago #

    Personally, I don't think that 100% accuracy is necessary in that case - after all, one could use the "exclude/include" parameters in the gallery shortcode, and only show certain images - while still all of them are nicely and properly attached to an existing post. :)

    It seems like the only reliable option to actually determine which images are really used in the post/page itself (and not just attached) is to run the shortcode. Not really necessary from my point of view, but then again, my view is somewhat limited, as I'm only looking at it from my use case. :)

    Thanks
    Alexander.

  6. David Lingren
    Member
    Plugin Author

    Posted 1 year ago #

    Alexander,

    Thanks for sending more information by e-mail and for your comments on HTML rendering in [mla_gallery]. You wrote:

    I've been playing with the [mla_gallery] shortcode a little bit and I noticed a difference to the standard WP [gallery] shortcode: HTML in the image descriptions is not interpreted in mla_gallery.

    It's true - I decided to filter the output to prevent malicious script in the content from being executed. However, WordPress takes a different approach:

    Why are some users allowed to post unfiltered HTML?

    I will change [mla_gallery] in my next release to conform to the choices WordPress has made. Thanks for your feedback on this issue.

  7. Alexander S. Kunz
    Member
    Posted 1 year ago #

    If your evaluation of that functionality differs from the default WP behaviour, my personal take would be: leave the choice up to the users, and add a setting to configure the behaviour.

    ( ) interpret markup (default WP behaviour)
    ( ) do not interpret markup (recommended, more secure)

    Something like that.

    HTH
    Alexander.

  8. David Lingren
    Member
    Plugin Author

    Posted 1 year ago #

    Thanks for the suggestion. I am going to add more control over the styles and HTML markup returned by [mla_gallery], and adding a "do/don't interpret" parameter to the shortcode might be better than an option on the Settings page. I'll default to the current WordPress behavior, of course.

  9. David Lingren
    Member
    Plugin Author

    Posted 1 year ago #

    I have released version 0.71, which adds "Gallery in" and "MLA Gallery in" columns to the MLA display. This release also distinguishes between a parent that does not exist and a parent that does not include any references to the attachment.

    I believe this resolves your issues with "BAD PARENT" and "ORPHAN" indications. Let me know if you have any further issues; thanks!

  10. UaMV
    Member
    Posted 1 year ago #

    'Gallery in' and 'MLA Gallery in' seem to not be working for me. Addtionally i am receiving the (ORPHAN)(BAD PARENT) messages as well ... running 1.00. i thought it may be that i didn't have the Where Used set for these, but they are currently set to be Dynamic. Thoughts?

  11. David Lingren
    Member
    Plugin Author

    Posted 1 year ago #

    The Gallery in and MLA Gallery in logic looks for [gallery] and [mla_gallery] shortcodes in your post/page content. If a shortcode is found, the database query it contains is executed to see which attachments are actually displayed in the gallery.

    The BAD PARENT message means that the attachment is not actually used in the post/page to which it is attached. The ORPHAN message means there is no post/page that actually uses the attachment.

    If you have a post or page with a [gallery] or [mla_gallery] shortcode, and one or more of the ORPHAN/BAD PARENT attachments appears in the gallery - that's an issue. If you can send me a link to the post/page in question and give me the HTML/Text source in the post/page content I will look into it.

    Let me know if that helps, and if you have any more information or questions about this issue. Thanks!

  12. UaMV
    Member
    Posted 1 year ago #

    i'll try and pull this together for you. Just visited the Assistant again, and now the Title/Name column includes question marks on these items (ORPHAN?)(BAD PARENT?). Not sure if that helps you diagnose what might be happening. Don't think the question marks were there before.

  13. David Lingren
    Member
    Plugin Author

    Posted 1 year ago #

    There are four where-used categories; Featured in, Inserted in, Gallery in and MLA Gallery in. The question marks are added when you disable one or more (but not all) of the categories, because some of the where-used checks are not performed so the results are not complete.

    For example, if you disable the "Gallery in" category the plugin will not process the [gallery] shortcodes and therefore cannot detect attachments that are part of the [gallery] output.

    If all four categories are disabled you will see "NO REFERENCE TESTS" in those columns.

  14. UaMV
    Member
    Posted 1 year ago #

    Ah, right. i had since set to 'Cache' for both of those. Just reset to 'Dynamic' and the questions marks are still there. Tried disabling to maybe flush the cache, then set 'Dynamic', still there. Hmm.

  15. David Lingren
    Member
    Plugin Author

    Posted 1 year ago #

    You can flush/refresh the Gallery in or MLA Gallery in cache by setting those options to "Refresh". That performs a one-time refresh and then sets the option back to Cached.

    The question marks only appear when one or more of the four options are set to "Disabled". Did you disable the Featured in or Inserted in categories? If none of the four options is Disabled and you still get question marks, that's a separate issue.

  16. UaMV
    Member
    Posted 1 year ago #

    Check out this page. The images (in a [gallery]) are parented fine. The docs embedded in the [expand][mla_gallery] are orphaned/bad parent. Could it be that they are in the [expand]? These pages use jQuery Collapse-O-Matic plugin. Thanks!

    Text/HTML from Post

    [gallery columns="3" link="file" ids="4527,4525,4526,4524,4523,4528"]
    
    The above files are only a few of those available for download. Images are available in the following zipped folders. When possible, use these in World Mission Prayer League presentations as they match the look of our other publications. Enjoy!
    
    [expand title="Slide Images" tag="div" trigclass="level-2 third" targclass="level-2-targ"][mla_gallery post_mime_type="all" ids="4529,4530" mla_markup="file_list" mla_style="file_list_style" captiontag="span"][/expand][expand title="Slide Templates" tag="div" trigclass="level-2 third" targclass="level-2-targ"][mla_gallery post_mime_type="all" ids="4534,4535,4532,4533" mla_markup="file_list" mla_style="file_list_style" captiontag="span"][/expand][expand title="Powerpoint Templates" tag="div" trigclass="level-2 third" targclass="level-2-targ"][mla_gallery post_mime_type="all" ids="4537,4539,4536,4538" mla_markup="file_list" mla_style="file_list_style" captiontag="span"][/expand]
  17. UaMV
    Member
    Posted 1 year ago #

    i think this may likely be the culprit, as i have docs elsewhere, not in the [expand] that show a healthy parent. Look forward to your findings.

  18. brpubs
    Member
    Posted 1 year ago #

    I have a similar issue, with images showing up as correctly parented in the library list but as orphaned/bad parent in assistant. In one case, it's because I've uploaded the image to a sidebar callout that is set up using Advanced Custom Fields. In another, it's because several images are within a post, but set to display (in a lightbox) only when a link is clicked. Are these types of uses something you might incorporate into an upcoming update, or do you have any recommendations for changes I might make?

    Thanks!

  19. David Lingren
    Member
    Plugin Author

    Posted 1 year ago #

    First, my humble apologies to UaMV - your 1/10/13 post got lost in my shuffle and I apologize for the long delay in responding! Your suspicion that the [expand] shortcode was involved is exactly right. I downloaded Collapse-O-Matic, ran some tests and reproduced your problem. My plugin did not properly handle [gallery] and [mla_gallery] shortcodes embedded within another shortcode such as [expand]. I have fixed this issue and it will be in my next release (probably 1.40). Thanks for posting your page source and the link to your example.

    On to new business (brpubs). It's possible that your "lightbox" issue is the same as the [expand] issue. Are there shortcodes-within-shortcodes involved?

    It would be helpful of you could post the Text/HTML from your page/post, as UaMV did above. I can try to reproduce your specific problem if I have more information about how you set up the sidebar callout and the lightbox display. A link to the page, if possible, might be helpful as well.

  20. UaMV
    Member
    Posted 1 year ago #

    Thanks for checking that. No worries that it has taken some time to do so. It's been displaying fine on the front end and I've not had to work with the back end too much since. It will be nice it have that working properly in the next release though. Thanks for your work!

  21. brpubs
    Member
    Posted 1 year ago #

    Hi David --

    Sending page link by email. And yes, it does seem that the issue is essentially the same. One photo is within a "callout" field created through Advanced Custom Fields plug-in, called within a sidebar widget created using Enhanced Text Widget. So there's a the_field shortcode to pull in the sidebar text the client enters. And the text widget itself is within an aside shortcode.

    The other photos are within the body of the page but within a hidden div, referenced by links that open a lightbox, using Lightbox Plus Colorbox. So I guess if Lightbox is using a shortcode both for the link and for the id of the hidden div that the link opens, it also qualifies as a shortcode within a shortcode.

    Like UaMV, though, this really isn't a significant problem since it all displays fine on the front end. I just wanted to figure out what the issue was so that I could explain it to my client when I turn this over to them in a couple of weeks.

    Thanks so much for the quick response -- and for the plug-in, which is a huge help.

  22. David Lingren
    Member
    Plugin Author

    Posted 1 year ago #

    brpubs - Thank you for sending the additional information regarding your example. Further analysis revealed that Lightbox Plus Colorbox was not the problem, and that the images on your page were being picked up by the MLA "Inserted in" logic. In this case, the images had been uploaded twice (not uncommon) and stored with subtly different file names (appending "1" to the name on the second upload). Removing the duplicate items cleared up the confusion.

    The sidebar widget containing the image is still an issue. MLA searches the body of every post/page, but does not search widgets, custom fields and other places where an image reference might be found. I am looking into this as a future enhancement.

    Thanks again for using the plugin, for bringing these issues to my attention and for working with me to resolve them.

  23. brpubs
    Member
    Posted 1 year ago #

    Thanks so much for your help with this -- really appreciate it!

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic

Tags

No tags yet.