David Lingren
Forum Replies Created
-
Forum: Plugins
In reply to: [Media Library Assistant] Fatal error after activationThank you all for reporting this MLA defect, caused by changes in the v3.21 update. I regret the problems it caused.
I have released MLA v3.22, which should correct the problem. I am marking this topic resolved, but please update it or start a new topic if you have problems with the v3.22 version. Thanks again for alerting me to this MLA defect.
Forum: Plugins
In reply to: [Media Library Assistant] load_textdomain_just_in_timI have released MLA version 3.21, which contains the fixes for this topic. I am marking the topic resolved, but please update it if you have any problems with the new version. Thanks again for reporting the problem and testing the fix.
Forum: Plugins
In reply to: [Media Library Assistant] List filter on the Assistant screenI have released MLA version 3.21, which contains the enhancements and fixes for this topic. I am marking the topic resolved, but please update it if you have any problems with the new version. Thanks again for inspiring and testing this MLA improvement.
Forum: Plugins
In reply to: [Media Library Assistant] Assign category to user submitted mediaIt has been five weeks since my last post in this topic. I assume you have found a solution that works for your application.
I am marking this topic resolved, but please post an update if you would like further help with it.
Forum: Plugins
In reply to: [Media Library Assistant] load_textdomain_just_in_timThanks for your report and for including the error log information; very helpful.
I have not been able to reproduce the issue on my system despite following the tips provided by @f14m07. However, I have done some research and made code changes that should solve the problem.
I have uploaded a new MLA Development Version dated 20241117 that corrects the problem. You can find step-by-step instructions for using the Development Version in this earlier topic:
How to download & install the current development version of MLA
Once the Development Version is installed you can retest the handling of i18n initialization.
The fix will be part of my next MLA version, but in the interim it would be great if you could install the Development Version and let me know if it works for you. Thanks for alerting me to this MLA defect.
Forum: Plugins
In reply to: [Media Library Assistant] List filter on the Assistant screenThanks for taking the time to install and test the Development Version. Thanks especially for noticing and reporting the presence of the new dropdown on other admin screens; a harmless MLA defect.
I have fixed the problem and the fix will be in the next MLA update. If you need an updated Development Version, let me know.
Thanks for your question. I assume when you write “programatically” you mean that you want to write some PHP code that executes an MLA query to return “all assets with a specific tag“; is that right?
There are a few ways to accomplish your goal. They use different methods to execute this MLA shortcode:
[mla_gallery post_parent=all post_mime_type=all attachment_tag=abc]
Where you can adjust the final parameter to use the taxonomy and term names/slugs to suit your application.
This shortcode returns HTML markup that displays a gallery containing the selected Media Library items. You could use the WordPress
do_shortcode()
function to execute it, or you could call MLA’sMLAShortcodes::mla_gallery_shortcode()
function directly. You can find function definitions and documentation in the/media-library-assistant/includes/class-mla-shortcodes.php
file.For programatic use, however, you probably don’t want to mess with the HTML markup. You can get an array of attachment objects, attachment ID values or ID and post_parent properties by calling the
MLAShortcodes::mla_get_shortcode_attachments()
function. You can add the Return Fields Parameter in the $attr array to set return values. There are three options:- ‘all’ – Return all fields (default).
- ‘ids’ – Return an array of post IDs.
- ‘id=>parent’ – Return an array of stdClass objects with ID and post_parent properties.
Passing anything else will return all fields (default) – an array of post objects. Here’s a code fragment you can tinker with:
$attr = array( 'post_parent' => 'all', 'post_mime_type' => 'all', 'attachment_tag'' => 'abc', 'fields' => 'all' );
$results = MLAShortcodes::mla_get_shortcode_attachments( 0, $attr );I hope that gets you started on a solution for your application. I am marking this topic resolved, but please update it if you have problems or further questions regarding the above suggestions. Thanks for your interest in the plugin.
Forum: Plugins
In reply to: [Media Library Assistant] List filter on the Assistant screenThanks for your update. My Internet connection was out for 25 hours on Sunday, so I had some quiet time to work on your suggestion. I went with the number one option because I think people are more likely to find the new feature there.
I have uploaded a new MLA Development Version dated 20241027 that includes the enhancement. You can find step-by-step instructions for using the Development Version in this earlier topic:
How to download & install the current development version of MLA
Once the Development Version is installed you can click on the Media/Assistant Screen Options pull-down area to try out the List Filter dropdown option. Pick the taxonomy you want and click “Apply” to refresh the screen with the new filter terms.
The enhancement will be part of my next MLA version, but in the interim it would be great if you could install the Development Version and let me know how it works for you. Thanks for inspiring this MLA enhancement.
Forum: Plugins
In reply to: [Media Library Assistant] List filter on the Assistant screenGood to hear from you again, and thanks for an interesting suggestion.
I have been thinking of a simple way to add the “List Filter” selection to the Media/Assistant screen. There are two solutions that I can investigate:
- Add a dropdown control to the “Screen Options” area at the top of the screen. I am not sure WordPress allows a way to do this, but I can look into it.
- Add a dropdown control or a radio button to the Terms Search popup window. This might be easier to implement.
Either approach would trigger a page refresh, and the new selected taxonomy would populate the term filter dropdown above the submenu table. Would this be useful for you? Do you have a preference between the two alternatives?
I will leave this topic unresolved for now and I hope to hear back from you soon.
Forum: Plugins
In reply to: [Media Library Assistant] Does MLA work with Breakdance builder?Thanks for your questions. I have no experience with the Breakdance Website Builder and do not know if there are any compatibility issues. MLA does work with several other page and site builders, so it’s worth a try.
I regret that there are no MLA tutorials, although there is a document that explains the MLA metadata mapping features. You might find these earlier topics helpful:
Too complicated for a new user of WP ? | www.remarpro.com
Basic newbie where to start | www.remarpro.com
You wrote “I would need just to somehow separate files into various “folders”“. MLA does not provide any support of its own for organizing a Media Library into folders, but you may find this earlier post helpful:
Feature Request – Duplicate Image | www.remarpro.com
I hope that gets you started on considering MLA for your application. I am marking this topic resolved, but please update it or start a new topic if you have problems or further questions regarding the above suggestions. Thanks for your interest in MLA.
Forum: Plugins
In reply to: [Media Library Assistant] Excluding a tagThanks for taking the time to try and adapt my suggestions and for your update. I think I have a better idea of your goal.
Based on your first post I thought “
information-leaflet+not-expired+neurology
” was a single term slug. Now I think you intended it to be “information-leaflet
” AND ”not-expired
” AND ”neurology
“, i.e., items must be assigned to all three terms to be included. Is that right? If so, cleaning up the terms and adding a parameter should give you what you want. Here’s an update of my original suggestion:[mla_gallery]
mla_markup=information-leaflets
tax_query="array(
'relation' => 'AND',
array(
'taxonomy' => 'attachment_tag',
'field' => 'slug',
'terms' => array('information-leaflet', 'not-expired', 'neurology'),
'operator' => 'AND'
)
array(
'taxonomy' => 'attachment_tag',
'field' => 'slug',
'terms' => 'headache-clinic',
'operator' => 'NOT IN'
)
)"
[/mla_gallery]Of course, your ID-based alternative will also work if you add the ‘operator’ parameter to the query.
I hope that completes the solution; let me know if you have any problems or further questions.
Forum: Plugins
In reply to: [Media Library Assistant] Excluding a tagThanks for your question and for including the complete text of your shortcode; very helpful. You can use a taxonomy query to add the tag exclusion to your existing shortcode. You can read about them in the Taxonomy Queries, the “tax_query” section of the Settings/Media Library Assistant Documentation tab. Here is a shortcode that achieves your goal:
[mla_gallery]
mla_markup=information-leaflets
tax_query="array(
'relation' => 'AND',
array(
'taxonomy' => 'attachment_tag',
'field' => 'slug',
'terms' => 'information-leaflet+not-expired+neurology'
)
array(
'taxonomy' => 'attachment_tag',
'field' => 'slug',
'terms' => 'headache-clinic',
'operator' => 'NOT IN'
)
)"
[/mla_gallery]This example uses an alternative syntax that can help you avoid parsing problems with long shortcodes; the “enclosing shortcode” syntax. You can find more information in the “Entering Long/Complex Shortcodes” section of the Documentation tab. If your page includes multiple [mla_gallery] shortcodes, be sure to add the closing [/mla_gallery] to every shortcode on the page to avoid parsing problems.
I hope that gets you started on a solution for you application. I am marking this topic resolved, but please post an update if you have problems or further questions regarding the above suggestions. Thanks for your interest in the plugin.
Forum: Plugins
In reply to: [Media Library Assistant] Assign category to user submitted mediaMLA does not have any form of conditional logic to do something like “if form id is 5 then attachment_category=wedding”. You will have to put the value, e.g., wedding, somewhere in the form so it is sent to the server when the form is submitted. You could add a dropdown control to the form with a list of values or you could define a hidden field containing a form-specific value like “wedding”. In either case, note the field id at the top of the Field Options tab, e.g. “(ID #2)”. Here’s an example of the values passed to the server from my test form:
wpforms[fields][4]:
wpforms[fields][3]:
wpforms[fields][1][first]: David
wpforms[fields][1][last]: Lingren
wpforms[fields][2]: wedding
wpforms[id]: 9762
wpforms[nonce]: f8eee17696
page_title: Form Preview
page_url: https://l.mladev/?wpforms_form_preview=9762&new_window=1
page_id: 9762
wpforms[post_id]: 9762
wpforms[submit]: wpforms-submit
wpforms[token]: e342ab73b470c09d58072cb1171bd03c
action: wpforms_submitYou can see the value I selected in my dropdown control,
wpforms[fields][2]: wedding
.Now you can define an MLA mapping rule to be applied when an image is uploaded to the Media Library:
- Go to the Settings/Media Library Assistant IPTC/EXIF/WP tab.
- Since you want to apply the rule to new items as they are uploaded, check the “Enable IPTC/EXIF Mapping when adding new media” and “Enable IPTC/EXIF Mapping when updating media metadata” boxes.
- Find the rule name that corresponds to the taxonomy you are using, e.g., Att. Categories
- Hover over the rule name and click the “Edit” rollover action.
- In the “IPTC Value” dropdown control leave the default, “- None (select a value) -” value in place.
- In the “EXIF/Template Value” text box, enter
template:([+request:wpforms.fields.2+])
. This assigns the term named in the dropdown control (or hidden field). Substitute the field id value from your form. - In the “Priority” dropdown, select “EXIF”.
- In the “Existing Text” dropdown, select “Replace” to replace the current field content, or select “Keep” to retain any terms assigned by other means. For new uploads you can use either option.
- In the “Status” text box, select “Active”.
- Scroll down to the bottom of the screen and click “Update”.
This works well if you have only one form. If you have multiple forms you would need to ensure that the same field id is used on all forms to assign an atttachment_category or be present with an empty value. If that’s not possible, you can use the hooks MLA provides to customize the rule processing logic. For example, test the
wpforms[id]: 9762
value and only look for your field if the form id matches. If you need more details on that solution, let me know.I hope that gets you started on a solution for your application. I will leave this topic unresolved for now in case you have problems or further questions regarding the above suggestions. Thank you for your interest in the plugin.
Thank you for sending the two problem files by email. I was able to find and fix a few MLA defects they exposed during upload and editing.
In one file, Title, Keywords and Subject are encoded as arrays of ASCII(?) integer character values; they should be strings. They are not actually part of the Exif standard but are commonly added by many editing tools. The same values are available in the exif:WINXP array. I added some code to detect the array and convert it to an ASCII string.
I also noticed that the ‘UserComment’ field has a legal, but odd value:
‘SSUCv3H4sIAAAAAAAAA22MSw6DMAxE7+J1Fi1VN7kKYuEGA1YDQbEjtUK5e81n2d3zm/Fs8ELhAH4D6llTZozgbw44xiKaUTktJqqDgEqjFUj2No60hK+RJddEu+0d8AAOpLx2qO6P6+wlUySUfartLFHUIufwvXnkAXzjoKc1Ces6JU1ymkw4i/JMxzlYEBkPXvmjF6Wlfx4kU1GlLJrC20StPyPEPHDuAAAA’,
This is harmless but I wanted to bring it to your attention. It is properly specified as an ‘ASCII’ encoded field. Here’s how the EXIF standard defines UserComment:
A tag for Exif users to write keywords or comments on the image besides those in <ImageDescription>, and without the character code limitations of the <ImageDescription> tag.
In the other file, the ‘ExposureBiasValue’ has a value of ‘0/0’, which caused infinite loop in MLA enhanced CAMERA values decoding. I have added some code to correct this problem.
In my testing, both of these files are now uploaded and edited without any problems. I have uploaded a new MLA Development Version dated 20240912 that corrects the problem. You can find step-by-step instructions for using the Development Version in this earlier topic:
How to download & install the current development version of MLA
Thank you for installing and testing the Development Version to confirm the fixes I implemented. The fixes will be part of my next MLA version, but in the interim they are available in the Development Version. Thanks for alerting me to these MLA defects.
Thanks for your report. I would be happy to work with the two files that are causing trouble and see if I can improve how MLA handles them.
You are welcome to contact me at my web site to send the files by email. I can post a summary here when the issue is resolved. Thanks for your interest in the plugin.