This is the technical support forum for WPML - the multilingual WordPress plugin.

Everyone can read, but only WPML clients can post here. WPML team is replying on the forum 6 days per week, 22 hours per day.

This topic contains 6 replies, has 2 voices.

Last updated by Otto 2 years, 11 months ago.

Assigned support staff: Otto.

Author Posts
August 26, 2016 at 8:31 am #1023552

Gabriel

I am trying to:
install wpml and language switcher in my theme
URL of (my) website where problem appears:
local dev website, not public url
I expected to see:
language switcher
Instead, I got:
Fatal error: __clone method called on non-object in C:\wamp\www_ql\wp-content\plugins\sitepress-multilingual-cms\sitepress.class.php on line 2832
Call Stack
# Time Memory Function Location
1 0.0004 255488 {main}( ) ...\index.php:0
2 0.0013 259512 require( 'C:\wamp\www_ql\wp-blog-header.php' ) ...\index.php:44
3 0.6432 34883568 require_once( 'C:\wamp\www_ql\wp-includes\template-loader.php' ) ...\wp-blog-header.php:16
4 0.6477 34915000 include( 'C:\wamp\www_ql\wp-content\themes\qualityline-child\front-page.php' ) ...\template-loader.php:89
5 0.6477 34915056 get_header( ) ...\front-page.php:7
6 0.6477 34915696 locate_template( ) ...\general-template.php:45
7 0.6479 34915944 load_template( ) ...\template.php:521
8 0.6484 34973944 require_once( 'C:\wamp\www_ql\wp-content\themes\qualityline-child\header.php' ) ...\template.php:562
9 0.6804 35118568 do_action( ) ...\header.php:54
10 0.6804 35120096 call_user_func_array:{C:\wamp\www_ql\wp-includes\plugin.php:525} ( ) ...\plugin.php:525
11 0.6804 35120160 wpml_add_language_selector_action( ) ...\plugin.php:525
12 0.6804 35120352 SitePress->get_language_selector( ) ...\template-functions.php:956
13 0.6805 35120960 SitePress->get_desktop_language_selector( ) ...\sitepress.class.php:3312
14 0.6805 35122328 SitePress->get_ls_languages( ) ...\sitepress.class.php:3080
Steps to duplicate the issue:

install plugin on multisite wp, network active, add switcher in child theme as wordpress action php.

DEBUG INFO:

{"core":{"Wordpress":{"Multisite":"Yes","SiteURL":"http:\/\/ql.loc","HomeURL":"http:\/\/ql.loc","Version":"4.4.4","PermalinkStructure":"\/blog\/%year%\/%monthnum%\/%day%\/%postname%\/","PostTypes":"post, page, attachment, revision, nav_menu_item, product, product_variation, shop_order, shop_order_refund, shop_coupon, shop_webhook","PostStatus":"publish, future, draft, pending, private, trash, auto-draft, inherit, wc-pending, wc-processing, wc-on-hold, wc-completed, wc-cancelled, wc-refunded, wc-failed"},"Server":{"jQueryVersion":"1.11.3","PHPVersion":"5.6.24","MySQLVersion":"5.6.17","ServerSoftware":"Apache\/2.4.9 (Win64) OpenSSL\/1.0.1t PHP\/5.6.24"},"PHP":{"MemoryLimit":"256M","WP Memory Limit":"64M","UploadMax":"64M","PostMax":"3M","TimeLimit":"120","MaxInputVars":"25000","MBString":true,"libxml":true}},"plugins":{"active_plugins":{"DashboardAdminLinkPanel\/dashboard_admin_link_panel.php":{"Plugin Slug":"","Name":"Dashboard link panel","PluginURI":"http:\/\/www.quality-line.org","Version":"1.3","Author":"Quality-Line","AuthorURI":"","TextDomain":"","DomainPath":"http:\/\/www.quality-line.org","Network":false,"Title":"Dashboard link panel","AuthorName":"Quality-Line"},"footable\/footable.php":{"Plugin Slug":"","Name":"FooTable","PluginURI":"http:\/\/fooplugins.com\/plugins\/footable-lite\/","Version":"0.3.1","Author":"Brad Vincent","AuthorURI":"http:\/\/fooplugins.com","TextDomain":"","DomainPath":"","Network":false,"Title":"FooTable","AuthorName":"Brad Vincent"},"ql-dashboard\/ql-dashboard.php":{"Plugin Slug":"","Name":"QL Main Dashboard Manager","PluginURI":"http:\/\/quality-line.org","Version":"1.03.00","Author":"Maxim Gamurar","AuthorURI":"http:\/\/quality-line.org","TextDomain":"","DomainPath":"","Network":false,"Title":"QL Main Dashboard Manager","AuthorName":"Maxim Gamurar"},"ql-registration\/ql-registration.php":{"Plugin Slug":"","Name":"QL Custom Registration\/Redirector","PluginURI":"http:\/\/quality-line.org","Version":"1.0","Author":"Maxim Gamurar","AuthorURI":"http:\/\/quality-line.org","TextDomain":"","DomainPath":"","Network":false,"Title":"QL Custom Registration\/Redirector","AuthorName":"Maxim Gamurar"},"sitepress-multilingual-cms\/sitepress.php":{"Plugin Slug":"sitepress-multilingual-cms","Name":"WPML Multilingual CMS","PluginURI":"https:\/\/wpml.org\/","Version":"3.5.1","Author":"OnTheGoSystems","AuthorURI":"http:\/\/www.onthegosystems.com\/","TextDomain":"","DomainPath":"","Network":false,"Title":"WPML Multilingual CMS","AuthorName":"OnTheGoSystems"},"woocommerce\/woocommerce.php":{"Plugin Slug":"","Name":"WooCommerce","PluginURI":"http:\/\/www.woothemes.com\/woocommerce\/","Version":"2.5.0","Author":"WooThemes","AuthorURI":"http:\/\/woothemes.com","TextDomain":"woocommerce","DomainPath":"\/i18n\/languages\/","Network":false,"Title":"WooCommerce","AuthorName":"WooThemes"},"wpml-string-translation\/plugin.php":{"Plugin Slug":"wpml-string-translation","Name":"WPML String Translation","PluginURI":"https:\/\/wpml.org\/","Version":"2.4.1","Author":"OnTheGoSystems","AuthorURI":"http:\/\/www.onthegosystems.com\/","TextDomain":"","DomainPath":"","Network":false,"Title":"WPML String Translation","AuthorName":"OnTheGoSystems"}},"mu_plugins":[],"dropins":[]},"theme":{"Name":"qualityline","ThemeURI":false,"Author":"quality-line.org","AuthorURI":"http:\/\/quality-line.org","Template":"","Version":"2.0","TextDomain":"qualityline","DomainPath":""},"extra-debug":{"WMPL":{"hide_upgrade_notice":"3.5.1","icl_capabilities_verified":true,"interview_translators":1,"existing_content_language_verified":1,"language_negotiation_type":3,"theme_localization_type":2,"icl_lso_header":0,"icl_lso_link_empty":0,"icl_lso_flags":"1","icl_lso_native_lang":"1","icl_lso_display_lang":0,"sync_page_ordering":1,"sync_page_parent":1,"sync_page_template":1,"sync_ping_status":1,"sync_comment_status":1,"sync_sticky_flag":1,"sync_password":1,"sync_private_flag":1,"sync_post_format":1,"sync_delete":0,"sync_delete_tax":0,"sync_post_taxonomies":1,"sync_post_date":0,"sync_taxonomy_parents":0,"translation_pickup_method":0,"notify_complete":1,"translated_document_status":1,"remote_management":0,"auto_adjust_ids":1,"alert_delay":0,"promote_wpml":0,"troubleshooting_options":{"http_communication":1},"automatic_redirect":0,"remember_language":24,"icl_lang_sel_type":"dropdown","icl_lang_sel_stype":"mobile","icl_lang_sel_orientation":"vertical","icl_lang_sel_copy_parameters":"","icl_widget_title_show":0,"translated_document_page_url":"auto-generate","sync_comments_on_duplicates ":0,"seo":{"head_langs":1,"canonicalization_duplicates":1,"head_langs_priority":1},"posts_slug_translation":{"on":0,"string_name_migrated":true},"languages_order":["en","zh-hans","ja","ru"],"urls":{"directory_for_default_language":0,"show_on_root":"","root_html_file_path":"","root_page":0,"hide_language_switchers":1},"xdomain_data":1,"active_languages":["en","ja","ru","zh-hans"],"admin_default_language":"_default_","taxonomy_names_checked":true,"ajx_health_checked":true,"setup_complete":1,"st":{"db_ok_for_gettext_context":true,"sw":[],"WPML_ST_Upgrade_Migrate_Originals_has_run":true,"WPML_ST_Upgrade_Db_Cache_Command_has_run":true,"strings_per_page":10,"icl_st_auto_reg":"disable","strings_language":"en","translated-users":[]},"default_categories":{"en":"1","zh-hans":8,"ja":9,"ru":10},"default_language":"en","setup_wizard_step":4,"admin_text_3_2_migration_complete_40cd750bba9870f18aada2478b24840a":true,"font-current-normal":"#444444","font-current-hover":"#000000","background-current-normal":"#ffffff","background-current-hover":"#eeeeee","font-other-normal":"#444444","font-other-hover":"#000000","background-other-normal":"#ffffff","background-other-hover":"#eeeeee","border":"#cdcdcd","icl_lang_sel_config":{"font-current-normal":"#444444","font-current-hover":"#000000","background-current-normal":"#ffffff","background-current-hover":"#eeeeee","font-other-normal":"#444444","font-other-hover":"#000000","background-other-normal":"#ffffff","background-other-hover":"#eeeeee","border":"#cdcdcd","background":"#eeeeee"},"icl_lang_sel_footer_config":{"font-current-normal":"#444444","font-current-hover":"#000000","background-current-normal":"#ffffff","background-current-hover":"#eeeeee","font-other-normal":"#444444","font-other-hover":"#000000","background-other-normal":"#ffffff","background-other-hover":"#eeeeee","border":"#cdcdcd","background":"#eeeeee"},"icl_language_switcher_sidebar":"0","icl_lang_sel_footer":0,"icl_post_availability":0,"icl_post_availability_position":"below","icl_post_availability_text":"This post is also available in: %s","language_selector_initialized":1,"translation-management":{"notification":{"new-job":1,"completed":1,"resigned":1,"dashboard":true,"purge-old":7},"custom_fields_translation":{"title":2,"description":2,"keywords":2,"_edit_last":0,"_edit_lock":0,"_wp_page_template":0,"_wp_attachment_metadata":0,"original_post_id":0,"_wpml_original_post_id":0,"_wp_old_slug":0,"_icl_translator_note":0,"_alp_processed":0,"_pingme":0,"_encloseme":0,"_icl_lang_duplicate_of":0,"_thumbnail_id":0,"_wp_attached_file":0},"custom_fields_readonly_config":["title","description","keywords","_edit_last","_edit_lock","_wp_page_template","_wp_attachment_metadata","original_post_id","_wpml_original_post_id","_wp_old_slug","_icl_translator_note","_alp_processed","_pingme","_encloseme","_icl_lang_duplicate_of","_thumbnail_id","_wp_attached_file"],"custom_fields_translation_custom":[],"custom_fields_translation_custom_readonly":[],"doc_translation_method":0,"__custom_types_readonly_config_prev":[],"custom_types_readonly_config":[],"__custom_fields_readonly_config_prev":[],"__custom_term_fields_readonly_config_prev":[],"custom_term_fields_readonly_config":[],"custom-types_readonly_config":[]},"custom_posts_sync_option":[],"icl_additional_css":"","display_ls_in_menu":0,"menu_for_ls":0,"site_does_not_use_icl":true}}}

August 26, 2016 at 11:17 am #1024074

Otto
Supporter

Languages: English (English ) Spanish (Español )

Timezone: America/Argentina/Buenos_Aires (GMT-03:00)

Hello,

Thank you for contacting the WPML support!

The WP memory limit needs to be increased. PHP memory is fine but WordPress uses 40Mb as default. Minimum requirements for WPML are 128Mb: https://wpml.org/home/minimum-requirements/

Can you please increase the memory limit to 256MB:
https://codex.wordpress.org/Editing_wp-config.php#Increasing_memory_allocated_to_PHP

Add this code to your wp-config.php to increase WP memory:

/** Memory Limit */
define('WP_MEMORY_LIMIT', '256M');
define( 'WP_MAX_MEMORY_LIMIT', '256M' );

Paste it just before:

/* That's all, stop editing! Happy blogging. */

This is happening only with this theme, right? With other themes (Twenty Fourteen for example) the issue is gone, no?

Are you using a custom theme? Is it based on some other theme? Which one?

Is it possible for you to share a copy of the theme, so I can try it locally and investigate further?

I'll set next reply as private, so you can share a download link safely.

Once the issue is solved I'll delete the files.

Kind Regards,

Otto

August 29, 2016 at 7:47 am #1026904

Gabriel

Hello!
I've changed memory limit and it did not help of course.
Try yourself with any theme to do the following:
1 create wp mulitsite within the same domain.
2 activate network-wide wpml plugin
3 use any theme and create child theme.
4 add language switcher to child theme header

August 29, 2016 at 12:05 pm #1027681

Otto
Supporter

Languages: English (English ) Spanish (Español )

Timezone: America/Argentina/Buenos_Aires (GMT-03:00)

Hello,

Thank you for the explanation.

I managed to reproduce the issue locally. Can you please confirm if when completing the WPML setup in the subsite the issue is gone?

Kind Regards,

Otto

August 30, 2016 at 3:20 am #1029318

Gabriel

This is not expected behavior.
I need configuration and installation to be available only on main website, subsite should not have ability to change wpml settings.
Is that possible?

August 30, 2016 at 4:12 am #1029340

Gabriel

I expect it to work like this - if network activated and not configured per subsite - use global configuration.

August 30, 2016 at 11:22 am #1036811

Otto
Supporter

Languages: English (English ) Spanish (Español )

Timezone: America/Argentina/Buenos_Aires (GMT-03:00)

Hello,

Please apologize for the misunderstanding. I just wanted to check if we are seeing the same behavior. I do understand that this is not the desired behaviour.

Even if WPML is network activated the settings are per subsite, and there is no standard feature to use main site settings as default for the subsites.

Regarding the error when using the language selector in the theme in a subsite where WPML was not configured yet you can use the following hook:

// $is_wpml_configured will return TRUE if WPML is fully setup and FALSE if not.
$is_wpml_configured = apply_filters( 'wpml_setting', false, 'setup_complete' );

So you can condition showing the selector or not be depending on that.

Does this make sense? Did it work?

Let me know your results, please.

Kind Regards,

Otto

The topic ‘[Closed] Language Switcher – fatal error in theme’ is closed to new replies.