Okay
  Public Ticket #3488012
Cant remove images from image gallery due to javascript error
Closed

Comments

  •  30
    damien started the conversation

    Hi,  hope all is well with you and the team?

    We can no longer remove images using the "X" icon within the Image Gallery settings. Is this related to recent PHP updates or My SQL updates? Do you have a recommended fix?

    Thanks 

    Damien

    Attached files:  Screenshot 2023-09-28 at 10.40.24.png

  •  1,921
    Judith replied

    Hello Damien,

    Thanks for writing to us.

    This is not an issue we are reproducing on our end. Please check whether it is a cache issue by deactivating any caching plugins.

    Also please select these options from the Salient theme options and see whether that helps :

    3564121280.png

    I hope this helps.

    Thanks.

  •  30
    damien replied

    Hi,

    WPRocket has been entirely disabled on the site and all caches cleared. Ive also enabled the two options youve recommended and retried and it dosnt work in Chrome, I cant remove existing images from galleries.

    It does however work in SAfari.

    Its a very weird issue and I really hope theres a solution since only mac users can acces Safari :(

  •  1,921
    Judith replied

    Hi Damien,

    Thanks for writing back.

    I request you share with us your admin login details to help establish the cause of this issue from your end.

    Best Regards.

  •   damien replied privately
  •  1,921
    Judith replied

    Hi Damien,

    Thanks for sharing your logins.

    Your home page just keeps loading and not opening, please check whether you are experiencing the same on your end:

    8013913407.png

    Thank you.

  •  30
    damien replied

    Hey Judith,

    Urgh, sorry about that. Weve been having a bunch of issues upgrading salient based sites from PHP 7.4 to 8.2 and I think this one also has issues.

    Ive reverted it back to PHP 8.0 and the front-end is now loading again!

    You should still be able to login via https://africanhorsdev.wpengine.com/wp-login.php with the same creds. Maybe the 2 things are related?

    Id really appreciate you taking a look at the gallery image deletion javascript issue.

  •  8,939
    Tahir replied

    Hey Again,

    Were you able to test for a plugin conflict?. You can do this by deactivating all third party plugins, and seeing if the problem remains. If it’s fixed, you’ll know a plugin caused the problem, and you can narrow down which one by reactivating them one at a time.

    Thanks.


    ThemeNectar Support Team 

  •  30
    damien replied

    Hey Tahir,

    Sure, I can do that and hopefully find the issues. The problem only occurs in Chrome.

    Have you not had any similar reports?

  •  8,939
    Tahir replied

    Please try it and let us know. We havent had anyone report such an issue yet.

    Thanks 


    ThemeNectar Support Team 

  •  30
    damien replied

    so Ive deactivated everything, except the core Salient plugins, cleared all cache and the problem persists...

    The dev site is running PHP 8.0

    Any other tips to resolve this?

  •  30
    damien replied

    memory limit is set to max with hosts 512mb so its not that either. Think this may be a theme bug or something?

  •  8,939
    Tahir replied

    Hey Again,

    Try switching to a Default Theme and check if Salient is indeed causing this?.

    Thanks.


    ThemeNectar Support Team 

  •  30
    damien replied

    Hey Tahir, I activated another theme and tested and the function for removing images from the gallery still dosnt work...so now Im really confused.

    It doesnt work when all salient themes are disabled, it doesnt work when all plugins (except slaient core) as disabled. 

  •  8,939
    Tahir replied

    Hey Again,

    Please see response from the developer regarding a similar issue: https://themenectar.ticksy.com/ticket/3488652/

    Thanks.


    ThemeNectar Support Team 

  •  30
    damien replied

    What is being said in the link you shared is partially true, but actually, its still a bug with your plugins that I would recommend gets fixed as Im sure others will encounter this.

    In the file: js_composer_salient\include\classes\editors\class-vc-edit-form-fields.php the following method changes as follows:

    public function enqueueScripts() {
        $output = '';
        $scripts = apply_filters( 'vc_edit_form_enqueue_script', WpbakeryShortcodeParams::getScripts() );
        if ( is_array( $scripts ) ) {
            foreach ( $scripts as $script ) {
                $custom_tag = 'script';
                // @todo Check posibility to use wp_add_inline_script
                // @codingStandardsIgnoreLine
                $output .= '<' . $custom_tag . ' src="' . esc_url( $script ) . '"></' . $custom_tag . '>';
            }
        }

        return $output;
    }


    to


    public function enqueueScripts() {
        $output = '';
        $scripts = apply_filters( 'vc_edit_form_enqueue_script', WpbakeryShortcodeParams::getScripts() );
        if ( is_array( $scripts ) ) {
            foreach ( $scripts as $index => $script ) {
                // @todo Check posibility to use wp_add_inline_script
                // @codingStandardsIgnoreLine
                $output .= '<script>';
                $output .= 'if ( document.getElementById("js-composer-salient-script-' . $index . '") ) { document.getElementById("js-composer-salient-script-' . $index . '").remove(); }';
                $output .= 'var script_' . $index . ' = document.createElement("script");';
                $output .= 'script_' . $index . '.src = "' . $script . '";';
                $output .= 'script_' . $index . '.id = "js-composer-salient-script-' . $index . '";';
                $output .= 'document.getElementsByTagName("HEAD")[0].appendChild(script_' . $index .');';
                $output .= '</script>';
            }
        }

        return $output;
    }


    This is because appended script tags, do not load under chrome.

  •  8,939
    Tahir replied

    Hey Again,

    Thanks for the additional information. Escalating this to the developer.

    Thanks.


    ThemeNectar Support Team