inpsyde / multilingual-press

The multisite-based free open source plugin for your multilingual WordPress websites.
https://multilingualpress.org/
GNU General Public License v3.0
234 stars 38 forks source link

MultilingualPress returning incorrect relationships #299

Open ahmed-sigmalux opened 6 years ago

ahmed-sigmalux commented 6 years ago

Version Information

Steps to Reproduce

  1. Link a.1 (site.page) to b.2 and click update
  2. Now change the link to b.1 and click update
  3. Refresh the page and MultilingualPress still returns b.2

What I Expected

MultilingualPress should return the new relationship of a.1 to b.1.

What Happened Instead

Whatever relationship is set the first time cannot be changed. I have tried flushing the cache without success. Nothing relevant is generated in the debug log.

Dinamiko commented 6 years ago

Hi ahmed-sigmalux,

I'm not able to reproduce the issue in current stable branch (2.11), which version of MultilingualPress are you using?

Assuming that your are using Change relationship / Select existing post in translation metabox, after selecting b.1, do you click Save and reload this page button (inside translation metabox) or default post Update button?

AboutLabs commented 6 years ago

Hi Dinamiko,

in our MLP WordPress installation we have the same behavior mentioned by ahmed-sigmalux, we are using the current version of the mlp plugin 2.11.0 apart from that the following versions:

In the mentioned use case we clicked Save and reload this page.

Dinamiko commented 6 years ago

Hi Charokee,

I'm still not able to reproduce this issue, can you please explain me the exact steps that are you doing? thanks.

AboutLabs commented 6 years ago

Hi Dinamiko,

the problem shows as follows: We have a Post or Page on the german site (DE) and a Post or Page on the english site (EN). If I link a DE-Page with an EN-Page or vice versa, everything works fine. The problem starts, if I want to change the relationship of a page that already has a relation with another. So if I want to remove the relationship of the DE-Page and the EN-Page, the relationship does not change. If I want to create a new relationship between a DE-page and a new EN-page (or vice versa), the relationship does not change.

So linking DE Page 1 —> EN Page 1 for the first time works. Removing link DE Page 1 —> EN Page 1 does not work. Linking DE Page 1 —> EN Page 2 does not work.

Our only workaround to create new relationships with so far otherwisely linked pages or posts is to recreate them in both languages (so they have no relationship yet) and linking them. That means, everytime we want to change an URL or a relationship, we would have to recreate the pages or posts concerned.

Bare in mind, all PlugIns, that might interfere are turned off. Only the PlugIn 'MultilingualPress' is activated in the network section for the whole network.

I created the multilingual multisite network with the help your PlugIn 'WPML to MultilingualPress' / WP CLI. In addition to that I used the WordPress Importer to import DE posts from an existing blog for the new blog section in the multisite.

Also I read in some posts of the enfold theme forum (the theme we use), only wpml translation are officially supported.

Thanks for the support!

Dinamiko commented 6 years ago

Hi Charokee,

Regarding the theme, I'm not sure if you did it already, but did you tried to switch temporally to a default WordPress theme to see if the problem persist?

AboutLabs commented 6 years ago

Hi Dinamiko,

thanks for the good advice, after installing, activating 2017 wordpress default and switching back to our enfold child theme the relationships work again as supposed to. It seems that the default theme restored some buggy settings in the whole environment. For now we have a kind of fix, do you have an idea who to debug this bug decently? It might be interesting for future updates of MultilingualPress.

But for now, merry xmas!

gitigritty commented 6 years ago

Hi Dinamiko, unfortunately, the problem that Charokee described above, persists. After switching to the default wp theme, some formerly not matching translation pages would have the right relationship. However, when I tried to manually set relationships where missing, it became evident that changing relationships doesn't take effect. Even worse, trying to change some relationships manually as described by Dinamiko, seems to also affect other pages and there relationships. Do you have any idea how this can happen and what else we could try?

Thanks a lot in advance!

ahmed-sigmalux commented 6 years ago

I'm still seeing this problem in 2.11.0.

Is there an extended debug option we can enable to get more insight with what's going wrong?

Dinamiko commented 6 years ago

@gitigritty I'm still not able to reproduce the issue yet, can you explain the steps that are you doing to reproduce the issue? also any relevant information about your context (MLP version, PHP version...) that you consider important, thanks.

@ahmed-sigmalux we do not have a debug option in MLP, I've created a quick video reproducing the steps and then check relationships in database: https://vimeo.com/248952624

gitigritty commented 6 years ago

@Dinamiko I couldn't reproduce it exactly that way either, but I managed to isolate the problem. Lately, it only occurred with one specific page that used to be defined as the blog page using the enfold theme (more precisely: a child theme based on enfold). However, that wasn't the case any more, when the problem became evident. At this point, we already had another page defined as corporate blog page. As to the former blog page: It was completely impossible to change the relations of this page. It just wouldn't save any changes with regard to the multilingual fields at the bottom.

So eventually, I ended up deleting this page and the respective translation page completely (also from trash), regenerated both pages and inserted the former content through the layout builders "safe template function". After setting the relationship from the main language, everything seems to work fine.

So after all I assume that there might be something related to the way enfold handles those pages defined as blog main page. I will let you know in case we find out more. Or do you have any other ideas based on that details?

beceha commented 6 years ago

@gitigritty having exactly the same issue with ENFOLD, too. Are there any news about that issue?

MultilingualPress 2.11.0 WP 4.9.4 Multisite PHP 7.0.25

gitigritty commented 6 years ago

@studioart We are not 100% sure, but we figuered out that a plugin named "Permalink Manager" hat something to do with it. After recreating the blog page again having removed that plugin before we didn't see those issues any more. So if you are using Premalink Manager, too, maybe it's worth testing the site without it. Good luck!

ahmed-sigmalux commented 6 years ago

@Charokee : I checked the MySQL multilingual_linked table and believe I have identified the reason why MultilingualPress returns the wrong relationships.

When MLP returns the correct relationship, the multilingual_linked table has entries like:

| ml_id | ml_source_blogid | ml_source_elementid | ml_blogid | ml_elementid | ml_type |
|  2060 |                1 |                1160 |         1 |         1160 | post    |
|  2061 |                1 |                1160 |        30 |         1614 | post    |
|  2062 |                1 |                1160 |        39 |         1527 | post    |
|  2063 |                1 |                1160 |        37 |         1597 | post    |
|  2064 |                1 |                1160 |        36 |         1996 | post    |
|  2065 |                1 |                1160 |        33 |          815 | post    |
|  2066 |                1 |                1160 |        34 |          106 | post    |
|  2067 |                1 |                1160 |        40 |           76 | post    |
|  2069 |                1 |                1160 |        26 |            8 | post    |

When MLP returns the incorrect relationships, however, the table has entries like:

| ml_id | ml_source_blogid | ml_source_elementid | ml_blogid | ml_elementid | ml_type |
|  2068 |                1 |                2419 |         1 |         1534 | post    |

It appears the ml_source_elementid and ml_elementid are referencing 2 different posts for the same blogid.