Viewing 8 posts - 1 through 8 (of 8 total)
  • Author
    Posts
  • #1470917

    Hello, a client’s website is currently stuck on Enfold version 5.3.1.1. Whenever I attempt to update the theme, the site crashes. I troubleshooted by deactivating plugins and determined that the issue fell with the WPML Multilingual CMS plugin. When trying to deactivate that specific plugin, the site crashes again.

    I reached out to our host WPMUdev for support and this is what they said:

    About the error that you are getting, the log is showing the following:

    PHP Fatal error: Uncaught Error: Class “avia_WPML” not found in /var/web/staging/public_html/wp-content/themes/AMPwp/functions.php:38

    This points to the theme AMPwp which is a child theme of Enfold, this child theme is called avia_WPML which doesn’t seem to be available on the new version of Enfold, this could be related to possibly Enfold or WPML renaming a class on its code.

    Please keep in mind that this type of fix (the actual fix to the class in the code) is out of the scope for our support, it would be better to reach out the Enfold support and confirm with them if maybe there is something that you should update on your child theme functions.php.

    Also, to give you further info, this is the specific part of the code on the child theme functions.php causing issues:

    function avia_remove_main_menu_flags(){
    global $avia_WPML;

    add_filter( ‘wp_nav_menu_items’, [ new avia_WPML, ‘handler_append_lang_flags’ ], 9999, 2 );
    remove_filter( ‘wp_nav_menu_items’, [ ‘avia_WPML’, ‘handler_append_lang_flags’ ], 9998, 2 );
    remove_filter( ‘avf_fallback_menu_items’, [ ‘avia_WPML’, ‘handler_append_lang_flags’ ], 9998, 2 );
    remove_action( ‘avia_meta_header’, ‘avia_wpml_language_switch’, 10 );
    remove_action( ‘ava_main_header_sidebar’, ‘avia_wpml_language_switch’, 10 );
    }
    add_action(‘init’,’avia_remove_main_menu_flags’, 9999);

    Please help me fix this issue so we can update the site and move forward. I’ve included production and staging site credentials in the private content. Let me know if there is anything else you need from me. Thanks!

    #1470921

    to make sure that you have used the correct characters everywhere, please post the code in the code tag.

    Next: what should the code do? isn’t it possible to remove all flags by the plugin itself? WPML – Languages – Menu language switcher

    Where did you get this code snippet?

    add_filter( 'wp_nav_menu_items', [ new avia_WPML, 'handler_append_lang_flags' ], 9999, 2 );
    

    even if i write it this way :

    add_filter( 'wp_nav_menu_items', array(new avia_WPML(), 'handler_append_lang_flags') , 9999, 2 );
    

    it quits with errors.

    #1470922

    try to hamper it first by going to :
    Header – Extra Elements – Enfold WPML Language Flags (Global Setting)
    If they will be shown – then look to
    WPML – Languages – Menu language switcher

    it they still are shown try:

    function avia_remove_main_menu_flags() {
    	remove_filter( 'wp_nav_menu_items', [ avia_WPML(), 'handler_append_lang_flags' ], 9998, 2 );
    	remove_filter( 'avf_fallback_menu_items', [ avia_WPML(), 'handler_append_lang_flags' ], 9998, 2 );
    }
    add_action('init','avia_remove_main_menu_flags', 9999);
    #1470927

    Guenni, the code was given from WPMUdev support. Here it is in the correct format:

    About the error that you are getting, the log is showing the following:
    PHP Fatal error: Uncaught Error: Class "avia_WPML" not found in /var/web/staging/public_html/wp-content/themes/AMPwp/functions.php:38


    Also, to give you further info, this is the specific part of the code on the child theme functions.php causing issues:

    function avia_remove_main_menu_flags(){
    	global $avia_WPML;
    
    	add_filter( 'wp_nav_menu_items', [ new avia_WPML, 'handler_append_lang_flags' ], 9999, 2 );
        remove_filter( 'wp_nav_menu_items', [ 'avia_WPML', 'handler_append_lang_flags' ], 9998, 2 );
    	remove_filter( 'avf_fallback_menu_items', [ 'avia_WPML', 'handler_append_lang_flags' ], 9998, 2 );
    	remove_action( 'avia_meta_header', 'avia_wpml_language_switch', 10 );
    	remove_action( 'ava_main_header_sidebar', 'avia_wpml_language_switch', 10 );
    }
    add_action('init','avia_remove_main_menu_flags', 9999);

    I’m not trying to remove the flags from the site. I’m trying to update the theme without everything crashing.

    #1470961

    Hi,
    I’m not able to login to your staging site as it is htaccess password protected:
    Screen Shot 2024 11 09 at 9.06.28 AM
    Your PHP code from WPMUdev is to “remove” the flags, but it is not working, but you write that you don’t want to remove the flags, so it is best to remove the code.
    As for updating the theme, your live site says:
    Updates: enabled - token has changed and not verified
    try re-verifing the token at Enfold Theme Options ▸ Theme Update ▸ Enter a valid Envato private token
    Screen Shot 2024 11 09 at 9.25.27 AM
    If this doesn’t help then manually update using the following steps, as I recall v5.3.1.1 had an issue with the token, so you may have to manually update.
    Please test this on your staging site, or make a full server backup of your live site.
    To update your version of Enfold, download the latest installable WP version from your Theme Forest account and upload it to your WordPress ▸ Appearance ▸ Themes ▸ Add Themes ▸ Add New
    WordPress_Appearance_Themes_Add-Themes_Add-New.jpg
    after you choose the zip file and click install, you will see a This theme is already installed message because you are updating, you can continue
    Installing_theme_from_uploaded_file_This_theme_is_already_installed.jpg
    then you will see the Theme updated successfully message.
    Theme_updated_successfully.jpg

    Best regards,
    Mike

    #1471114

    Hello Mike,

    I understand the confusion of the PHP code now. I had pinpointed the WPML plugin as the cause of the issues when updating the theme as the site crashes when updating the theme or deactivating the plugin. The support staff member I spoke to from WPMUdev likely thought I wanted to just remove the flags from the site when I wanted to be able to remove the entire plugin to further test if it was the issue.

    As for updating the theme, I just attempted to update Enfold manually and there was another critical error on the site. The token was just rechecked and validated. The update to 6.0.6 is sitting in the Updates page, waiting.

    I’ve updated the staging site so it is accessible now. Credentials are below.

    #1471135

    Hi,

    Thank you for the update.

    Have you tried temporarily removing the avia_remove_main_menu_flags function before performing the update? Also, this function will generate an error if WPML is deactivated.

    Enfold manually and there was another critical error on the site.

    What is the new error? Please try to update the theme manually via FTP.

    // https://kriesi.at/documentation/enfold/theme-update/#update-via-ftp

    Best regards,
    Ismael

    #1471145

    First : how about your WordPress Version – does it need an update too?
    if there is a big difference – a major Update in WordPress too … make a Backup of your Installation – and maybe prepare your theme allready for that newest WP – see: Unfortunately, the theme is no longer set as sticky regarding the adaptation to newer php versions / WordPress versions. But that is not necessary and can be done afterwards
    What php Version you are running on your system – there are a few changes that need to be taken into account. Especially the changes from php7.x to php8.x and the implementation of jQuery 3.x …

    I have never had any problems with WPML updates and Enfold updates. However, I agree with you that plugins that interfere with many areas of a theme always carry update risks.
    That’s why I already have a good backup plugin installed for most sites for other reasons. Even the free version of Duplicator is a very good program.
    This program creates a complete backup in two files. A zip file with the contents, and an installation file for restoring the backup. Btw. this can also be used for migration.
    So if major updates are planned, I create a Duplicator backup beforehand and can then make the updates without losing the status quo.

    ________________

    Updating the theme – additionally you can update the theme by ftp upload : https://kriesi.at/support/topic/some-hints-and-advice-to-update-enfold/#post-1056107

    Uploading the new theme takes a little time; if all goes well, the page will only be offline for the small amount of time that it will be renamed. You have the old installation as fallback. (there is no overwriting of the old theme)

    Update via ftp.

    • download installable newest Enfold : unzip the file – you will have an enfold folder now
    • Rename that downloaded newest version to enfold-new
    • Upload that enfold-new folder to the themes folder
    • Rename your (existing) enfold folder to f.e. enfold-old / in your ftp client (f.e. filezilla)
    • Rename your enfold-new folder to enfold / again: in your ftp client (f.e. filezilla)
    • Go to dashboard – enfold(-child) – and refresh your merged/cached files on performance tab
    • Check if all your theme and existing settings work to your full satisfaction.
    • Yes – then stop here
    • No – delete or rename back the enfold folder back to enfold-new
    • rename the enfold-old folder back to enfold
Viewing 8 posts - 1 through 8 (of 8 total)
  • You must be logged in to reply to this topic.