File Gallery
File Gallery & WPML Javascript Issue (3 posts)

  1. Devise01
    Posted 3 years ago #


    Thank you for creating such a great plugin!

    I'm currently having an issue with File Gallery with the WPML plugin installed. Issue is occurring when File Gallery is attempting to insert the "Copy all attachments from this translation " buttons on the edit post page. If WPML is set to use the translation editor, the error below occurs.

    Error: Uncaught TypeError: Cannot call method 'pop' of null
    Source: file-gallery.js:1653

    var fg_icl_trans_id = Number($(this).attr('href').match(/post=([\d]+)&/).pop());

    I placed a breakpoint on this line and the current value of $(this).attr('href') is: /admin.php?page=wpml-translation-management/menu/translations-queue.php&job_id=49

    Obviously the URL is different if 'Use Translation Editor' is selected in WPML. Because of the error a number of interface related issues appear.

    Personally, I'd be happy for the button not to be there at all if using the translation editor.

    WordPress: 3.5
    WPML: 2.6.1
    File Gallery: 1.7.7

    Your support is much appreciated.

    Thank you and kind regards,


  2. Devise01
    Posted 3 years ago #

    My temporary fix:

    Replaced file-gallery.js:1653 with:

    // FIXED: issue where WPML editor is set to translation editor
    var fg_icl_trans_id = '';
    var fg_icl_trans_match = $(this).attr('href').match(/post=([\d]+)&/);
    if (fg_icl_trans_match)
    	fg_icl_trans_id = Number(fg_icl_trans_match.pop());
  3. Aesqe
    Plugin Author

    Posted 3 years ago #

    thanks for reporting and supplying a fix! :)

    included in v1.7.8, out soon.

Topic Closed

This topic has been closed to new replies.

About this Plugin

  • File Gallery
  • Frequently Asked Questions
  • Support Threads
  • Reviews

About this Topic