• Resolved Andy

    (@andywilmot)


    Hi, firstly thanks for providing a great free plugin.

    I was using the following shortcode in a PHP template to display all images tagged with a custom taxonomy, named ngg_tag.

    echo do_shortcode( ‘[mla_gallery ngg_tag=”‘. get_the_title() .'” orderby=”date DESC, menu_order DESC” size=”thumbnail” columns=”0″ mla_float=”left” mla_itemwidth=”100px” mla_margin=”0px” link=”full” mla_link_class=”venobox”]’ );

    I was using the post title to get the correct tag. It worked fine on most pages, but in some cases where special characters are used, I got several of the following errors:

    Warning: preg_replace(): Unknown modifier ‘0’ in /homepages/11/d579135750/htdocs/awakeningfighters/wp-content/plugins/media-library-assistant/includes/class-mla-shortcode-support.php on line 1361

    To avoid the special characters, I tried getting the tag name based on the post slug, so I changed the shortcode to the following:

    echo do_shortcode( ‘[mla_gallery ngg_tag=”‘. $post_slug .'” orderby=”date DESC, menu_order DESC” size=”thumbnail” columns=”0″ mla_float=”left” mla_itemwidth=”100px” mla_margin=”0px” link=”full” mla_link_class=”venobox”]’ );

    However, I am still seeing the same error messages on those pages, even though there are no special characters in the post slug. I tried removing all instances of special characters in the tag value also, but I still see the error messages.

    Any ideas why this is happening?

    • This topic was modified 7 years, 2 months ago by Andy.

    The page I need help with: [log in to see the link]

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

    (@dglingren)

    Thanks for the kind words and for your detailed description of the problem you’re having. Thanks as well for the link to an example page on your site; very helpful.

    The line in question (1361) and the other line exhibiting the same problem (1347) are working with the file name of the items in your [mla_gallery]. On your example page the first three images have a quote character in their file name, e.g.:

    Sarah-D'Alelio-at-Bellator-165.jpg

    The quote is converted to an HTML entity during the process, so the file name becomes:

    Sarah-D& #039;Alelio-at-Bellator-165.jpg (without the space after the ampersand)

    The MLA code is using the file name in a preg_replace() pattern, and in the current MLA version the pattern delimiter is “#”. The HTML entity in the file name contains the same character and the pattern is prematurely terminated. All of this is explained in great detail in this stackoverflow topic:

    Warning: preg_replace(): Unknown modifier

    WordPress removes quote characters when uploading new images, so it was hard for me to create a test case and reproduce your problem. How did you manage to upload these files and retain the quotes?

    In any case, I have developed a fix for the problem and I will upload a new MLA Development Version for you to try shortly. Thanks for alerting me to this issue and for your patience in awaiting a fix.

    Plugin Author David Lingren

    (@dglingren)

    I have uploaded a new MLA Development Version dated 20180105 that contains the fix for the defect you reported. It would be great if you can install the Development Version and do some testing of your own. To get the Development Version, follow the instructions in this earlier topic:

    504 Time-Out issue

    Let me know how it works for you. Thanks for your help with this issue and for your interest in the plugin.

    Thread Starter Andy

    (@andywilmot)

    Hi David, thanks for the fast response. For some reason I wasn’t getting notifications of your replies, but I will test this now… I’m not exactly sure how the images were uploaded with quotes. I recently transferred all my old NextGEN legacy images over to the media library using another plugin called Tags for Media Library (TML). It may have happened then.

    I stopped using TML because it had some bugs or conflicts which slowed the site down. That’s when I searched for an alternative and discovered your excellent plugin.

    Thread Starter Andy

    (@andywilmot)

    Wow! Thanks David, works perfectly. You just earned yourself 5 stars!

    Plugin Author David Lingren

    (@dglingren)

    Thanks for confirming the fix, answering my question and for your positive review. Reviews, donations and feedback are great motivators to keep working on the plugin and supporting its users.

    Let me know if there’s anything else I can do to help you get the most out of MLA.

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Warning: preg_replace(): Unknown modifier ‘0’ in’ is closed to new replies.