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 47 replies, has 3 voices.

Last updated by Andrey 1 year, 6 months ago.

Assigned support staff: Andrey.

Author Posts
January 13, 2018 at 12:09 am #1483594

berryP-2

I am trying to: show the sidebar

Link to a page where the issue can be seen: not publicly available yet, server is being built now

I expected to see: a sidebar

Instead, I got: an empty string.

Disclosure: I am using a custom Twig template. To show the sidebar I add Timber::get_widgets( 'sidebar_primary' ) to $context['sidebar'] in functions.php which is thus loaded on each page. As explained here: hidden link

Yet when it's returned, it's empty. I also var dumped it on the line after it was initialized, still empty.

Please understand, I'm not a noob and I have been a developer for about 10 years, so please skip the default questions.
- yes wordpress is on the latest version
- yes wpml is on the latest version as are all other plugins.

I have worked with Timber and WPML several times, but I have never encountered anything like this.

I have been building on this website for little over a year. I have created several custom widgets which are shown under conditions on several pages. It was debugged as hell and it worked perfectly, until I bought WPML 2 days ago and installed it. Since then all sorts of unexpected things happen.

The weirdest thing is the sidebar returning as empty. In the back-end all my widgets are initialized (see screenshot), no errors are shown in php error log and in console I also can't find a single indication (if it was to be a js error, which I doubt).

As soon as I deactivate WPML the sidebar is back.

Of course I eliminated the issue with the sidebar widget and only echoed a string instead of doing elaborate functions/calculations. Even a die() command is not executed, since the widgets are just not loaded.

I have tested with a Vanilla WP install with only WPML and Timber active and it does work there, so I am assuming it's theme related, since I have deactivated all plugins (which were possible to deactivate without disturbing core functions).

This frustrates me like hell. I have been working on it for the past 12 hours and I can't seem to make any progress.

I have installed the plugin PHP compatibility and I found this warning.

FILE: /Users/Beee/HTML/sexdates/webapp/content/plugins/sitepress-multilingual-cms/sitepress.php
-----------------------------------------------------------------------------------------------
FOUND 0 ERRORS AND 1 WARNING AFFECTING 1 LINE
-----------------------------------------------------------------------------------------------
1 | WARNING | File has mixed line endings; this may cause incorrect results
-----------------------------------------------------------------------------------------------

I'm not sure if this can be related, but I can't find it (yet).

----------------

I also find 2 small typos but this is not related.
Line 289/290 in sitepress.php it says $wpml_coolie_admin_ui.
I think this should be $wpml_cookie_admin_ui.

January 15, 2018 at 12:22 am #1484242

berryP-2

I have tested it on another site which is live. The exact same thing happens when I install WPML there. The entire sidebar is 'emptied'. See screenshot. Where the empty spot is, a sidebar should be shown (see freerides.org).

January 15, 2018 at 12:28 am #1484244

berryP-2

PS This happens after the (plugin) setup is done. When it's just activated (without configuring) the sidebar shows.

After step 1 is done, I reloaded and this error shows: Warning: preg_match(): Unknown modifier 'c' in /Users/Beee/HTML/freerides/webapp/content/plugins/sitepress-multilingual-cms/inc/absolute-links/absolute-links.class.php on line 176

This error shows after each 'step'. When the setup is done, the error is gone, but so is the sidebar.

January 15, 2018 at 9:51 pm #1485304

Itamar
Supporter

Languages: English (English ) Hebrew (עברית )

Timezone: Asia/Jerusalem (GMT+03:00)

Hi.

Is this the plugin that you are using?
https://wordpress.org/plugins/timber-library/
This plugin is included in our compatible plugins' list here.
https://wpml.org/plugin/timber/
If so then, I would like to try and replicate this problem on a clean WordPress installation.
What do I need to do for that?
Could you please tell me a step by step process of what I should do?

I have one thought of what might be the reason for this problem, but I'm not sure about it.
I suspect that it is happening because that WordPress is installed in a folder and not in the root of your site (I see it by the debug information). Could you please check what happens if you try it on an installation where WordPress is not installed in a folder but directly in the root of your site? Does it make a difference?

Thanks,
Itamar.

January 16, 2018 at 2:36 am #1485414

berryP-2

Hi Itamar, thanks for your answer.

As I mentioned in my initial post, I already tried it on a vanilla WP install (with everything default) and it worked there.

I installed the plugin, then deactivated it but the problem still remained. So I suspected it was in the db. I then removed all wp_icl_xx tables tables and the sidebar was back.

Both sites I tested it on have WP in a subdir.
This is my wp-config setup

if ( !defined( 'ABSPATH' ) ) {
    define( 'ABSPATH', dirname( __FILE__ ) . '/cms/' );
}

define( 'WP_HOME', '<em><u>hidden link</u></em>' . $_SERVER['HTTP_HOST'] );
define( 'WP_CONTENT_DIR', realpath( ABSPATH . '../content/' ) );
define( 'WP_CONTENT_URL', WP_HOME . '/content' );
define( 'WP_SITEURL', WP_HOME . '/cms' );

Attached is a screenshot which shows my setup.
The folder cms contains just a plain WP install.
No themes/plugins are in there.
They all reside in content.

January 16, 2018 at 12:19 pm #1485964

berryP-2

As extra info, this is the beginning (and I think maybe relevant part) of my .htaccess.

<IfModule mod_rewrite.c>
    Options +FollowSymlinks
    RewriteEngine On
    RewriteBase /

    RewriteCond %{REQUEST_FILENAME} -f
    RewriteRule .* - [L]

    RewriteRule ^cms/wp-admin/$ cms/wp-admin/index.php [L]

    RewriteRule .* cms/index.php [L]     # Use if live env is up
</IfModule>
January 16, 2018 at 1:39 pm #1486114

berryP-2

If I remove the database value for icl_sitepress_settings the sidebar shows again. So it should be somewhere in there.

Find the value here: https://pastebin.com/Fr0x0KX0

January 16, 2018 at 2:59 pm #1486229

berryP-2

I examined the JSON and I think this 'part' might be the culprit:

s: 4: "urls";a: 5: {
        s: 30: "directory_for_default_language";i: 0;s: 12: "show_on_root";s: 0: "";s: 19: "root_html_file_path";s: 0: "";s: 9: "root_page";i: 0;s: 23: "hide_language_switchers";i: 1;
    }

Can you confirm that ? And if so, do you know a workaround ?

January 16, 2018 at 9:26 pm #1486665

Itamar
Supporter

Languages: English (English ) Hebrew (עברית )

Timezone: Asia/Jerusalem (GMT+03:00)

Hi.

The part of the JSON that show in your last reply is the option 'Use directory for default language' that you can set in WPML -> Languages -> Language URL format when you are using 'Different languages in directories'. But you have not selected this option, so I do not see how it can be the culprit.

@berryp-2 I'm sorry, but it seems that this issue is beyond the scope of this support forum. If there is no issue with the Timber plugin on a clean WordPress installation and this issue is being caused by custom code and settings that you have added, I can not help you further. Please understand that these are the rules of our support forum.

At this point, I would suggest you consider contacting one of our certified partners from this link: http://wpml.org/documentation/support/wpml-contractors/
Before doing so, please have a look also here: http://wpml.org/documentation/support/wpml-contractors/guidelines-for-people-looking-for-consulting-help/

You will get the custom assistance you need to get on with your project.

January 16, 2018 at 9:27 pm #1486666

berryP-2

Is there a possible refund policy ? Because if this can't be fixed the plugin is pretty useless to me.

January 16, 2018 at 9:31 pm #1486668

Itamar
Supporter

Languages: English (English ) Hebrew (עברית )

Timezone: Asia/Jerusalem (GMT+03:00)

You can request refunds until 30 days of your purchase date. We will refund 100% of your payment – no questions asked.

https://wpml.org/purchase/refunds-policy/

January 16, 2018 at 9:32 pm #1486671

berryP-2

What if I setup the site on a private location... would that be of any help ? There you would have all the options to do/break/test whatever you want. Because I prefer to find a solution then to ask for a refund.

January 16, 2018 at 9:40 pm #1486685

Itamar
Supporter

Languages: English (English ) Hebrew (עברית )

Timezone: Asia/Jerusalem (GMT+03:00)

You can do that and then I would ask one of our second tier supporters to take a look and see if they understand what causes this issue. But please understand that even then I can not promise a fix for your custom code.
I'm enabling private message for the next reply so you can share the access details with us. Please add any further details that will help us get orientated in your WordPress set up.

Regards,
Itamar.

January 17, 2018 at 4:28 pm #1487614

Itamar
Supporter

Languages: English (English ) Hebrew (עברית )

Timezone: Asia/Jerusalem (GMT+03:00)

I can see one widget that is not showing when WPML is active.
It is the live video widget.
Please see attached screenshot.
Is the problem with this widget?
I'm sorry but I couldn't find /inc/widgets/ and /views/partials/widgets/ on your special WP set up.
Could you paste here the related code from these places, please?
Since it is all about your custom code and special set up I need you to make it easy for me to present the case to our second tiers supporters.
Could you please elaborate on your issue in a very descriptive way and add the relevant code snippets in the next reply?

Thanks,
Itamar.

January 17, 2018 at 4:34 pm #1487623

berryP-2

The widgets which are affected are the Country info widget, the country switch widget and the AWEmpire widget (which you blurred). The Country widgets are only shown on the pages Netherlands and Belgium (links are in the admin menu).

Everything which is normally in wp-content is now in content.

The code can be found in content/themes/themename/inc/widgets.
The output can be found in content/themes/themename/views/partials/widgets.