• Resolved lenehanj

    (@lenehanj)


    Hi David

    I am seeing an issue at the moment and I was wondering if you are aware of any current support requests surrounding my query.

    I have latest version of WordPress, the WPML and MLA plugins installed.

    I am displaying an image in an English post (base language) using the following shortcode:

    [mla_gallery ids=”1463″ columns=”1″ mla_caption=”{+caption+}” link=”file” size=”large”]

    This same shortcode is also in the German version of the post, however the shortcode is not rendering an image.

    When I look at the HTML for the post in Firebug, it seems like the shortcode is ignored completely.

    This used to work ok for me and the WordPress debug is showing up no errors.

    Would you have ideas how to troubleshoot this further?

    John

    https://www.ads-software.com/plugins/media-library-assistant/

Viewing 10 replies - 1 through 10 (of 10 total)
  • Thread Starter lenehanj

    (@lenehanj)

    Hi

    I have made some progress in that now the shortcode is partially working.

    It now is displays a hyperlink where the image should be and the correct translated caption underneath.

    The hyperlink points to the translated attachment page: ‘https://www.eupati.eu/?attachment_id=2272’. The shortcode should be rendering the image.

    J

    Plugin Author David Lingren

    (@dglingren)

    Thanks for your question and for posting the source text of your [mla_gallery] shortcode.

    You wrote “I have made some progress” – what changes did you make?

    I tested your original shortcode on my system and confirmed my suspicion that WPML is adding a language filter to the SQL query generated for the shortcode. As you know, each Media Library item is language-specific, with separate translations of the item for each active language. Since ids="1463" refers to an English translation it will be filtered out of a German post and the gallery will be empty.

    The easy way to fix the problem is to add the ID values for all translations to the shortcode, e.g., ids="1463,2272". WPML will select the appropriate image for each post language and ignore the other image translations.

    I am marking this topic resolved, since WPML and MLA are working as designed and the suggested workaround should give you the results you need. Please continue to update the topic if you have any problems or further questions regarding the ids behavior in [mla_gallery] when WPML is active. Thanks for your interest in the plugin.

    Thread Starter lenehanj

    (@lenehanj)

    Hi David

    Thank you for your reply.

    When I wrote that I had made some progress, unfortunately I could not identify what change that I made during my testing to relay back to you.

    I tried what you suggested by adding multiple ‘id’s to the shortcode but it made no difference in this case. Your solution is adequate but the issue is caused by WPML.

    When a media item is uploaded directly to the media library, whether or not the media item attachment is duplicated into the website languages is determined by a WPML Media plugin setting in the WPML Media plugin admin interface.

    ON: When uploading media to the Media library, make it available in all languages
    OFF: When uploading media to the Media library, do not make it available in all languages

    Because I have two distinct types of media files to upload (i.e. I have images that I want made available in all languages and images that I require to be different for each language) I will have to remember to turn this setting ON when I want to upload an image and have it copied across all translations and turn it OFF when I upload an image that I do not want it copied and just want a different image per translation.

    When I do this the following shortcodes work perfectly:

    Same image across all languages:
    [mla_gallery ids=”1578″ columns=”1″ mla_caption=”{+caption+}” link=”file” size=”large”]

    Different image for each language:
    [mla_gallery meta_key=”eupasset_name” meta_value=”bioavailability” columns=”1″ mla_caption=”{+caption+}” link=”file” size=”full”]

    Two things that would be really helpful would be:
    1. The ability to know whether a media item currently in the library has been copied to all languages or not. Ideally this would be useful in a column.
    (Any media items that have had been made available in all languages have the following custom field attached to their translated versions: wpml_media_processed = 1)

    2. The ability at the time of upload to select whether a media item should be made available to all translations or not in the upload dialogue window.

    (This could be an interface add on that could be turned on and off in the MLA Admin>Languages tab.

    The form code (taken from the WPML Media plugin admin interface using firebug)

    <form id=”wpml_media_options_form”>
    <input type=”hidden” name=”no_lang_attachments” value=”0″>
    <input type=”hidden” id=”wpml_media_options_action”>
    <label><input type=”checkbox” name=”content_default_always_translate_media” value=”1″ checked=”checked”> When uploading media to the Media library, make it available in all languages</label>
    </form>)

    Are these a settings you would consider adding to the MLA uploader in enhance integration with WPML?

    John

    Plugin Author David Lingren

    (@dglingren)

    Thanks for your update with the detailed explanation of your application and the distinction between all-languages and single-language items. Thanks as well for describing the “Two things that would be really helpful“.

    I believe your first suggestion is already implemented. The Media/Assistant screen displays the “flags” column(s) showing the translation status of each item. When WPML is in “All languages” mode the flags columns contain a check mark icon in the column that matches the language of the item, a pencil icon for translations already present and a plus sign icon for translations that do not exist. Clicking on the pencil or plus sign will take you to the Media/Edit Media screen for the item translation. Does this give you the information you need?

    Your second suggestion would make a good MLA/WPML enhancement. MLA adds a “Bulk Edit on Upload” area to the WordPress Media/Add New (Upload New Media) screen, and the checkbox could be added there. Would that work for your application? MLA does not provide a similar feature to the Media Manager Modal (popup) Window “Upload Files” tab, and I have no plans to add anything there. Is that a problem for your application?

    I will investigate the work required to add a WPML “duplicate media” checkbox to the Media/Add New (Upload New Media) screen and post an update here with my findings. Thanks for the idea and for your interest in the plugin.

    Thread Starter lenehanj

    (@lenehanj)

    Thanks so much for your reply.

    “MLA adds a “Bulk Edit on Upload” area to the WordPress Media/Add New (Upload New Media) screen, and the checkbox could be added there. Would that work for your application?”

    Yes that would be great

    “MLA does not provide a similar feature to the Media Manager Modal (popup) Window “Upload Files” tab, and I have no plans to add anything there. Is that a problem for your application?”

    No, I don’t think so.

    “The Media/Assistant screen displays the “flags” column(s) showing the translation status of each item. When WPML is in “All languages” mode the flags columns contain a check mark icon in the column that matches the language of the item, a pencil icon for translations already present and a plus sign icon for translations that do not exist. Clicking on the pencil or plus sign will take you to the Media/Edit Media screen for the item translation. Does this give you the information you need?”

    No, this is not the information I require.

    When I look at the All Languages screen, I can see a plus sign for a translation that does not exist and a pencil sign for a translations that does exist, this is all fine.

    It would be great to know which of the media in the library has the same media file shared between all languages, i.e this would have been done by the WPML Media plugin if the setting ‘When uploading media to the Media library, make it available in all languages’ was checked during the upload of the media item.
    I think you deermine this by the WPML custom field: “wpml_media_processed = 1”

    In a library with many files it would be useful to know which media files are shared between all languages.
    For example, one file and 7 attachements (7 languages)

    If a person know this inforamtion that can distinguish which images (or any media file) are same for all languages and with images are different for every language.

    It is not possible to get this information at the moment with out going into the media item.

    (If an attachment translation of a media file does not have “wpml_media_processed = 1” assiociated with it, then I would determine that the media is only specific to one language.)

    Plugin Author David Lingren

    (@dglingren)

    Thanks for your through responses to my suggestions and questions.

    I will see what I can do for the “shared file” items in WPML. In the interim you can get some of the information you seek by adding the “Base File” column to your Media/Assistant submenu table. Items that share the same file will have a common value in that column. You can click on the file name in the column to filter the display and show all the items sharing the file. Of course, this works best in the “All languages” mode.

    Plugin Author David Lingren

    (@dglingren)

    I have done more investigation into the wpml_media_processed custom field and how WPML handles items that share a file.

    The wpml_media_processed field is created and set to ‘1’ whenever a second (or subsequent) Media Library item is created as a translation of an original item, and thus shares a common file. There are two ways this can happen:

    1. You check the “When uploading media to the Media library, make it available in all languages” box to automatically duplicate items as they are uploaded.
    2. You manually create a translation by clicking the plus sign icon in the Media/Assistant “flags” column.

    Note that the second method will set the wpml_media_processed field even if the “make it available in all languages” checkbox is not checked.

    Also, the wpml_media_processed field is never set for the original item, only for the translations. If you share one file among three translations, two of them will have the field set and the original one will not. You wrote:

    (If an attachment translation of a media file does not have “wpml_media_processed = 1” associated with it, then I would determine that the media is only specific to one language.)

    That is not true; the original item (first language created) will not have this field set.

    If you have the “make it available in all languages” option checked, items will have a translation for all languages. If that option is not checked, you can still make an item available in one, several or all languages by manually creating translations with the plus sign icon.

    The check, pencil and plus sign icons in the “flags” column give you all the shared/not shared information there is; the only additional information provided by the wpml_media_processed field is the difference between the original item and the additional translations. Is that significant? If it is I can easily add that information to the “flags” column.

    Thread Starter lenehanj

    (@lenehanj)

    Hi David

    I have tested what you have suggested and the green tick will indeed tell me everything I need to know about the translation status of an image and whether it has been shared between languages or if it is standalone.

    I’m not sure what the WP community would do without your plugin and patient help.

    Maybe Automatic will incorporate your great work into their core and bring the media library up to speed.
    (And compensate you in the process of course.)

    Thanks so much for you help. If only all support forums could offer this level of detail and help.

    Regards

    John

    Plugin Author David Lingren

    (@dglingren)

    Thank you for thinking through my comments and for testing and confirming that you have the information you need. I always learn something from these topics and I appreciate the opportunity.

    Thanks as well for your kind words about the plugin and its support; they are a great motivation to keep working on it and supporting users like you.

    I agree that many MLA features would be suitable for WordPress core; I started working on MLA with just that perspective in mind. With recent releases and features like the “Media Grid” Automattic is headed in a somewhat different direction. I’ve also found quite a lot of PHP code in core that treats “attachments” as a special case; it would be a challenge to find and modify all that code to make attachments more like posts, pages and custom post types. Still, it’s an interesting project for some future date. Thanks for your vote of confidence.

    Plugin Author David Lingren

    (@dglingren)

    I have uploaded a new Development Version dated 20151108 that contains the WPML “duplicate new media on upload” control you suggested. It also contains some fixes for upload problems I found while testing the new feature.

    In the bottom-right part of the form you will see a new Yes/No dropdown control, initialized to the WPML default value for “When adding new media, make it available in all languages”. You can change the value for the duration of the upload process without disturbing the WPML default. I had to use a dropdown control because a checkbox does not get passed back to the server accurately.

    You can find step-by-step instructions for using the Development Version in this earlier topic:

    MLA errors when using plugin

    If you get a chance to try the Development Version please let me know how it works for you. Thanks for suggesting a useful enhancement to the WPML support.

Viewing 10 replies - 1 through 10 (of 10 total)
  • The topic ‘WPML and MLA issue’ is closed to new replies.