• Resolved Arjan

    (@a4net)


    Issue:
    At the Media Library page the checkboxes (ALT Text; terms, Title, Name etc) next to the search box are not respected.

    Case:
    Default search settings for ALT text and Terms are off.
    Using the Media Library page:
    – Use the search field and search for a value which only appears in ALT or TERMS.
    Result: No results; this is correct because the checkboxes for ALT text and Terms are not checked.

    – Use the search field; Check the boxes ALT text and Terms for search; search for a value which only appears in ALT or Terms.
    Result: No results; this in INcorrect; because the checkboxes for ALT text and Terms are check.

    Using the Media Library Assistant page:
    Check Tags or Terms and using search gives the desired results.

    Now alter the default Media Library Assistant settings to have the search options ALT text and Terms checked by default.
    The Media Library search now gives the desired results.
    When unchecking the ALT text and Terms at the Media Library it still show results as if the the ALT text and Terms where checked.

    So the Media Library search option always uses the default media-library-assistant search setting. It ignores the checkbox options.

Viewing 10 replies - 1 through 10 (of 10 total)
  • Plugin Author David Lingren

    (@dglingren)

    Thanks for your report and for the detailed description of the steps you followed to create the issue.

    I have just completed some tests on my own system and I cannot reproduce the issue you are having. I created a unique one-word phrase in one ALT Text field and a unique one-word term name in the Att. Categories taxonomy. I did not find any items when I applied the default (Title, Description) search. When I checked the ALT Text box I found the item containing the unique phrase. When I checked the “Terms” box I found the item assigned to the unique term name. Both searches worked on the Media/Assistant admin screen and in the WordPress Media/Library screen (grid mode).

    Any additional information you can provide, such as the specific values you are searching for and the setting of the and/or radio button will help me investigate further. Thanks for your patience and for any details you can add.

    Thread Starter Arjan

    (@a4net)

    My proces:
    I used a clean install; PHP7.3, WP:5.3.2, MLA:2.81.
    After the clean install:
    Go to the Media Library en upload an image (flower.jpg);
    Edit the image and fill in the ALT text field (1 word, for example: wordpress)
    Go to the Media Library, search for “wordpress”, no results (as expected)
    Check ALT text; search for “wordpress”, still no results.
    Go to Media Libray Assistant; search for “wordpress”, no results (as expected)
    Check ALT text; search for “wordpress”, 1 result.

    At the Media Library page there are no errors with the Ajax calls.
    When searching for the title (flower) it will show 1 result.

    Plugin Author David Lingren

    (@dglingren)

    Thanks for your update with the additional information. It looks like the search function on the MLA Media/Assistant page is working, but the WordPress Media/Library page (grid mode) is not working; is that right?

    I followed the steps you outlined on my system and I could not reproduce the problem. Does your site have any other plugins that modify the Media/Library grid mode screen?

    If you can access your site’s error log you can try activating MLA’s debug logging:

    • Navigate to the Settings/Media Library Assistant Debug tab.
    • Scroll down to the “MLA Reporting” text box and enter “3”. This will turn on MLA debug logging for AJAX Processing.
    • Click the Save Changes button to record your new setting.
    • Optionally, scroll to the bottom of the screen and click “Reset” to clear the error log. You may not want to do this depending on how you manage your error log.

    Once that’s done you can re-run one or more Search Media tests from the Media/Library screen. Then, go back to the Debug screen and:

    1. Enter “0” in the MLA Reporting text box to turn debug logic off.
    2. Click the Save Changes button to record your new setting.
    3. Scroll to the bottom and click “Download” to get the log content in a text file.

    You should see some log entries similar to this one:

    [05-Feb-2020 23:23:35 UTC] 37 MLA_Ajax::initialize( true ) $_REQUEST = array (
      'action' => 'query-attachments',
      'post_id' => '0',
      'query' => 
      array (
        'orderby' => 'date',
        's' => 
        array (
          'mla_filter_month' => '0',
          'mla_filter_term' => '0',
          'mla_terms_search' => '',
          'mla_search_clicks' => '1',
          'mla_search_value' => 'wordpress',
          'mla_search_fields' => 
          array (
            0 => 'terms',
            1 => 'alt-text',
          ),
          'mla_search_connector' => 'AND',
        ),
        'order' => 'DESC',
        'posts_per_page' => '40',
        'paged' => '1',
      ),
    )
    

    The ‘mla_search_value’ value should match your search term and the ‘mla_search_fields’ value should contain all the boxes you’ve checked.

    You can post the results here or contact me at my web site to get instructions on sending the log file information.

    Thanks for your patience and for any further information you can provide.

    Thread Starter Arjan

    (@a4net)

    Thank you for your help.

    Not sure what I am doing different.
    Using a fully clean WordPress installation. Installed the Media Library Assistant via the add plugin button and enabled it.
    I didn’t touch any settings after that (only enabled your debug settings for now)

    Your array with search fields is different from a default setting.
    In my array the alt-text is missing:

    [07-Feb-2020 13:24:34 UTC] 37 MLA_Ajax::initialize( true ) $_REQUEST = array (
      'action' => 'query-attachments',
      'post_id' => '0',
      'query' => 
      array (
        'orderby' => 'date',
        's' => 
        array (
          'mla_filter_month' => '0',
          'mla_filter_term' => '0',
          'mla_terms_search' => '',
          'mla_search_clicks' => '1',
          'mla_search_value' => 'wordpress',
          'mla_search_fields' => 
          array (
            0 => 'title',
            1 => 'excerpt',
            2 => 'content',
            3 => 'file',
          ),
          'mla_search_connector' => 'AND',
        ),
        'order' => 'DESC',
        'posts_per_page' => '40',
        'paged' => '1',
      ),
    )
    [07-Feb-2020 13:24:38 UTC] 601 MLACore::mla_plugins_loaded_action() MLA 2.81 () mla_debug_level 0x3

    Chrome itself sends the following to the server:

    action: query-attachments
    post_id: 0
    query[orderby]: date
    query[s][mla_filter_month]: 0
    query[s][mla_filter_term]: 0
    query[s][mla_terms_search]: 
    query[s][mla_search_clicks]: 1
    query[s][mla_search_value]: wordpress
    query[s][mla_search_fields][]: title
    query[s][mla_search_fields][]: excerpt
    query[s][mla_search_fields][]: content
    query[s][mla_search_fields][]: file
    query[s][mla_search_connector]: AND
    query[order]: DESC
    query[posts_per_page]: 40
    query[paged]: 1

    I tested with Chrome (All plugins disabled) and Firefox (No plugins); same result.

    So the data is already missing from the post itself.
    Console confirms that the checkbox checked:

    
    // ALT Text not checked:
    jQuery('input[name="s\\[mla_search_alt_text\\]"]:checked').length;
    0
    // ALT Text checked:
    jQuery('input[name="s\\[mla_search_alt_text\\]"]:checked').length;
    1
    Plugin Author David Lingren

    (@dglingren)

    Thanks for testing with the Debug logging on and for the additional details about your issue.

    I have confirmed that the problem occurs with the Chrome browser, but not with Microsoft Edge that I normally use. It’s rare that I encounter a browser-specific problem.

    I will investigate further and post an update here when I have progress to report.

    Plugin Author David Lingren

    (@dglingren)

    I have found and fixed the checkbox handling issues you reported. It turns out that Microsoft Edge triggers one event when a box is checked or unchecked while Chrome and Firefox trigger two events. The current MLA version handles both events, which changes the checkbox state twice leaving it unchanged.

    I have uploaded a new MLA Development Version dated 20200210 that includes the corrected code. 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 can install and test the Development Version, then let me know how it works for your application. Thanks for motivating this MLA fix.

    Thread Starter Arjan

    (@a4net)

    I can confirm it works in the most recent versions of:
    IE, Edge, Chrome, Safari, Firefox, Opera.
    Good job :thumbsup:

    Thread Starter Arjan

    (@a4net)

    Hi David,
    Do you have any indication when this fix will be officially released?
    Thanks

    Plugin Author David Lingren

    (@dglingren)

    I plan to make my next release shortly after WordPress 5.4 comes out, to make sure I maintain compatibility with that new version. In the interim, the Development Version is quite stable and you can use it with confidence if the checkbox handling is a significant annoyance.

    Plugin Author David Lingren

    (@dglingren)

    I have released MLA v2.82, which contains the fix for this defect. I am marking the topic resolved, but please update it if you have any problems or further questions regarding the fix. Thanks again for identifying this MLA defect.

Viewing 10 replies - 1 through 10 (of 10 total)
  • The topic ‘Media Library Search Checkboxes Options are not respected’ is closed to new replies.