Skip to content Skip to sidebar

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.

Sun Mon Tue Wed Thu Fri Sat
- 9:00 – 14:00 9:00 – 14:00 9:00 – 14:00 9:00 – 14:00 9:00 – 14:00 -
- 19:00 – 22:00 19:00 – 22:00 19:00 – 22:00 19:00 – 22:00 19:00 – 22:00 -

Supporter timezone: Europe/Paris (GMT+01:00)

This topic contains 51 replies, has 3 voices.

Last updated by George Botsev 7 years, 4 months ago.

Assisted by: Yvette.

Author Posts
October 8, 2018 at 2:01 pm #2796315

Václav

Hello,
I tested this now. When I submit the translation to the user, I don't see any db errors, but when I come to the "Translations" screen, I see following error (again, trying to read users table from wrong db ):

SELECT DISTINCT SUBSTRING_INDEX(ito.element_type, '_', 1) AS element_type_prefix, ito.element_type AS original_post_type 
FROM mw_625_icl_translate_job j JOIN mw_625_icl_translation_status s 
ON j.rid = s.rid JOIN mw_625_icl_translations t 
ON s.translation_id = t.translation_id JOIN mw_625_icl_translate iclt 
ON iclt.job_id = j.job_id JOIN mw_625_icl_translations ito 
ON ito.element_id = iclt.field_data 
AND ito.trid = t.trid JOIN (SELECT rid, MAX(job_id) job_id
FROM mw_625_icl_translate_job
GROUP BY rid ) jobmax 
ON ( j.revision IS NULL 
AND j.rid = jobmax.rid) 
OR ( j.job_id = jobmax.job_id 
AND j.translated = 1) 
LEFT JOIN mw_625_posts p 
ON t.element_id = p.ID 
LEFT JOIN mw_625_users u 
ON s.translator_id = u.ID 
WHERE s.status > 0
AND s.status <> 9
AND (j.translator_id = 1
OR j.translator_id = 0
OR j.translator_id IS NULL ) 
AND s.translation_service='local' 
AND ( (t.source_language_code = 'cs'
AND t.language_code IN ('en')) ) 
AND iclt.field_type = 'original_id'
October 8, 2018 at 3:00 pm #2796524

George Botsev
WPML Supporter since 02/2014

Languages: English (English )

Timezone: Europe/Sofia (GMT+02:00)

I checked this. Yes you are correct - there is still error.
I did an adjustment, replaced "prefix" with "base_prefix" as this should be the multi-site variant for handling similar cases.
However, this still does not work, as your multisite setup is split in two databases and the users database is in the "yotix" database, but all other sites are in the "yotix_" database.
At this time, I can only suggest that you hardcode this wherever necessary.
changing the line

LEFT JOIN {$wpdb->base_prefix}users u

to:

                LEFT JOIN yotlix.{$wpdb->base_prefix}users u
October 8, 2018 at 4:22 pm #2796925

Václav

Hello,
thanks. I think I resolved this. Diving deeper into wpdb class, I found out that the users table can be easily overriden globally. I reverted the changes back to

{$wpdb->users}

and defined in wp-config.php

define('CUSTOM_USER_TABLE','yotlix.mw_users');

DB errors are gone, I can see the waiting translations in the dashboard. Any possible issues with this solution?

Thanks!
V.

October 9, 2018 at 8:28 am #2798895

George Botsev
WPML Supporter since 02/2014

Languages: English (English )

Timezone: Europe/Sofia (GMT+02:00)

That is an awesome workaround that you found.
I am not familiar with that function of the wpdb class, but I am going to ask our developers.

Have you tested if you leave the prefix too if it is working?
If it works that way too - then perhaps everything will be just fine in my opinion...

October 9, 2018 at 10:13 am #2799409

Václav

Hello,
i found out that I broke the wp_insert_user function by this workaround, as it tries to find table

yotlix.yotlix.mw_users

I'll debug this more..:)

October 9, 2018 at 11:20 am #2799715

Yvette
Supporter

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

Timezone: Europe/Paris (GMT+01:00)

October 10, 2018 at 6:40 am #2803119

George Botsev
WPML Supporter since 02/2014

Languages: English (English )

Timezone: Europe/Sofia (GMT+02:00)

That is strange.
Do you have any custom functions that are hooking onto the user creation perhaps?
Yes - this would require a very serious debugging, and it could be coming from WordPress core itself.