Skip Navigation

[Resolved] WPML conflict with duplicated view

This thread is resolved. Here is a description of the problem and solution.

Problem: Cloned legacy View produces a PHP Notice when WPML is active:

Notice: Undefined index: id in path\to\site\wp-content\plugins\wp-views\backend\Services\WPMLService.php on line 44

Solution:
Our developers have issued a patch and will include the permanent fix in an upcoming release.

This support ticket is created 3 years, 10 months ago. There's a good chance that you are reading advice that it now obsolete.

This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.

Our next available supporter will start replying to tickets in about 0.40 hours from now. Thank you for your understanding.

Sun Mon Tue Wed Thu Fri Sat
8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 - -
13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 - -

Supporter timezone: America/New_York (GMT-04:00)

This topic contains 6 replies, has 2 voices.

Last updated by matthewC-9 3 years, 9 months ago.

Assisted by: Christian Cox.

Author
Posts
#1899069

Hi! I recently added WPML on a site that uses the legacy views plugin. On one page, I'm now getting this notice:

Notice: Undefined index: id in C:\wamp64\www\wpdev\wp-content\plugins\wp-views\backend\Services\WPMLService.php on line 44

Deactivating the WPML plugins makes the error go away.

The weird thing is that this view is a copy of another one. The view I copied it from does not give the error. I can't see any difference in the settings - the only real difference is the content of the template. But if I swap in the template from the original view, it does not make the notice go away. I'm stumped. Help?

-Sarah

#1900195

Hi Sarah, I'll be glad to help track down and resolve this PHP notice. Can you provide a bit more information so I can do a more in-depth investigation?
- Can you confirm your WPML and Toolset plugins are all up-to-date?
- Can you tell me if the View you metioned was duplicated before or after WPML was activated?
- Can you tell me the selected translation option for Content Templates in WPML > Settings > Multilingual Content Setup tab : Post Types translation panel?
- Can you tell me the selected translation option for Views in WPML > Settings > Multilingual Content Setup tab : Post Types translation panel?

I'll review your response and give you some additional feedback.

#1901507

Thanks, Christian!
- We're using Toolset Types 3.4.5, Toolset Views 3.3.5, WPML Multilingual CMS 4.4.8, WPML String Translation 3.1.6, WPML Media 2.6.2, and WPML Translation Management 2.10.4 - I think those are all the latest versions.
- The View was duplicated before WPML was activated.
- The translation option for both Content Templates and Views is set to "Translatable - use translation if available or fallback to default language."

One more thing I'll mention is that we've just added the WPML plugins and don't have any actual translations loaded up yet, for any of it.

Let me know if there's more info that would be helpful--

Thanks!
Sarah

#1901749

Okay thanks for that information, with that in mind I was able to recreate a very simple similar scenario. I created a View of the native Post type, added a Query filter based on post publication date, and inserted some basic information in the loop using Views shortcodes:

[wpv-post-link]<br />
[wpv-post-date]<br />
[wpv-post-author]<br />

Then I placed that View on a Page using the Block Editor and a View block. I visited that Page on the front-end of the site. All seems fine, the View shows one result with the proper content. Then I duplicated the View from the list of Views at Toolset > Views. Then I edited the same Page and chose the new View as the source in the View block. I saved the Page and visited it again on the front-end. Again, nothing obviously wrong. At that point I activated the 4 WPML plugins and did a basic installation setup. I turned on a couple of secondary languages and added a language switcher in the footer, but that was about all I did in the WPML configurations/setup. When I reloaded the Page containing the duplicate View, I was able to see the Undefined index: id notice appear several times in the logs. So the problem seems to be replicable, not an exception specific to your site or content.

Let me ask my 2nd tier team to take a look. I'll escalate to them and let you know what I find out.

#1902585

Okay our second tier team has escalated this issue to the Views developers and they have acknowledged the problem. We will include a fix for this issue in an upcoming release of the software. Thank you for the report, we'll get this resolved as soon as possible. I think we can close this ticket since it's a relatively simple issue without any major functionality impacts or broken features.

#1903007

Hello, our developers have provided a patch file that should resolve the notice:
https://drive.google.com/drive/folders/1YAIWqro2ptqcE3UMf_PolfyOSiZe9MMU?usp=sharing

To apply the patch, unzip it and upload the file it contains to replace the one in the same name, under /backend/Services/WPMLService.php on your Views or Blocks plugin installation.

Once you have replaced the file on the server, check the logs again to see if the notice is produced again. Please let me know the results.

#1906687

Yep, that took care of it! Thanks for the quick fix.