pods-framework / pods

The Pods Framework is a Content Development Framework for WordPress - It lets you create and extend content types that can be used for any project. Add fields of various types we've built in, or add your own with custom inputs, you have total control.
https://pods.io/
GNU General Public License v2.0
1.07k stars 264 forks source link

WPML: Pods fields on custom post type Spanish language are not showing up #3727

Closed therajumandapati closed 6 years ago

therajumandapati commented 8 years ago

Pods custom fields show up on other languages French, German and English. But not on Spanish. They were visible on version 2.6.6. They disappeared as soon as we updated PODS to 2.6.7.

WPML Version: 3.4.1

JoryHogeveen commented 8 years ago

Hi @mvpspl619

That's a really odd bug... Especially since the other languages give no errors..

Can you give some extra info?

Have you tried to clear the cache? (Pods Admin -> Settings -> "Clear Pods Cache")

Edit: Tried to reproduce your issue with es_ES language code. No issue found on my setup.

therajumandapati commented 8 years ago

@JoryHogeveen Custom Fields, locale is es_ES. Its interesting that PODS thinks that there are no custom fields for this custom post type in spanish language. But when we added the missing custom field manually in PODS under this language, it showed the previously saved data(the data before updating the plugin). The solution was to add the fields manually again and the data popped up just right. Does that ring any bells ?

JoryHogeveen commented 8 years ago

@mvpspl619 We'll no ringing bells yet.. What do you mean with "But when we added the missing custom field manually in PODS under this language". Pods doesn't support fields based on a language. It just adds fields for a post-type. Other plugins can add language information to content types but Pods doesn't do anything with that info except for relationship objects (or at least it shouldn't..)

sc0ttkclark commented 8 years ago

Adding @srdjan-jcc to this conversation as it pertains to the extensive testing they did.

JoryHogeveen commented 8 years ago

He's already looking into this. :) Told me it could be related to #2006

therajumandapati commented 8 years ago

@JoryHogeveen I understand that PODS doesn't support fields based on a language. But WPML has it's way of handling/separating data based on the selected language. Not sure how that affects PODS.

JoryHogeveen commented 8 years ago

@mvpspl619 Well that depends on the field type. For example, file and relationship field types are filtered by language when a language is set by WPML (or Polylang) for the related objects you set (media, posttypes, taxonomies, etc). So that's why I asked about the field types you used. Still.. it's strange the manually re-adding them fixed this issue because these filters are still in place after that. I still think this could be a simple cache issue since after you save a Pod, the cache for that Pod's settings is rebuild.

therajumandapati commented 8 years ago

@JoryHogeveen I'd also think that this is a simple cache issue. Wanted to inform you about its occurrence anyway just to be safe. Do you want to close this issue ?

srdjan-jcc commented 8 years ago

@mvpspl619 Hello, can you please tell me if issue is with edit post screen (like attached images)? pods-edit-post-images-en pods-edit-post-images

I tested template and duplicated posts with Pod Image fields. Seems working fine except images are not displayed when editing translated post. Meta fields are created correctly so could be issue with query on admin pages.

@sc0ttkclark I tried to debug issue with Pod Image (attachment ID) value but could not find exact breakpoint. There should be place where Pods check if attachment is valid Media Library item. Where I should look for?

JoryHogeveen commented 8 years ago

@srdjan-jcc This could be a "problem" with the get_current_language function in PodsAPI. If the attachment post-type is enabled for translations it only fethes the media items in the current language. If these aren't translated it can't find any. How does WPML handle media translations??

srdjan-jcc commented 8 years ago

@JoryHogeveen WPML creates separate post types entries ('attachment') for each language, referring to same image. WPML Media plugin scans Media Library and later you can translate image title, description etc. using WP GUI and language switcher.

Images are filtered fine if WP_Query or get_posts() is used. Of course if translation exists.

Let me know if this helps or I should elaborate more.

I'm still looking for breakpoint where attachments are fetched. Should I look more in PodsAPI class? All breakpoints there that ringed bell and I tested were not triggered.

JoryHogeveen commented 8 years ago

@srdjan-jcc That sounds like a similar approach as Polylang and should be fixed since 2.6.6 I'd say. All queries and i18n stuff for the file field is in PodsAPI.

That gets returned if the translation doesn't exists? The original or nothing?

Btw, Thanks so mutch @srdjan-jcc for helping is with WPML compat!

srdjan-jcc commented 8 years ago

@JoryHogeveen YW :) Image is NULL through whole loop while editing translated post.

wp-content/plugins/pods/classes/PodsMeta.php:1041 $value = $pod->field( array( 'name' => $field[ 'name' ], 'in_form' => true ) ); Every check if value exists fails in wp-content/plugins/pods/classes/Pods.php:658 Pods::field()

So all other breakpoints regarding WPML or Image Field are not triggered. Note that it happens only on post edit screen. I still cannot find where Pods are checking if meta exists or if images are valid.

therajumandapati commented 8 years ago

@srdjan-jcc Sorry for the delay. That is part of the problem, but the main problem was being that the custom fields didn't even show up on changing language. Not sure why.

srdjan-jcc commented 8 years ago

@mvpspl619 np :) Are you saying that field forms were missing? (like not registered) Or just values were empty?

therajumandapati commented 8 years ago

The fields were missing like they were not registered with PODS at all. But then if a field is registered, it persisted its previous value from other language. Not sure why.

Thanks, Raju

On Aug 26, 2016, 3:49 AM -0500, Srdjan Jocic notifications@github.com, wrote:

@mvpspl619 (https://github.com/mvpspl619) np :) Are you saying that field forms were missing? (like not registered) Or just values were empty?

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub (https://github.com/pods-framework/pods/issues/3727#issuecomment-242670163), or mute the thread (https://github.com/notifications/unsubscribe-auth/AFTEPZ6NFFWVS3Z6hO_zGbEBJ5MJOqgLks5qjqiSgaJpZM4Jl3xS).

srdjan-jcc commented 8 years ago

@mvpspl619 I tried to replicate issue upgrading Pods from 2.6.6 to 2.6.7 but cannot confirm issue you reported. Fields are there (registered).

Is there a chance that you have DB dump from point where issue is exposed? Or any other info that might help to reproduce? (e.g. are posts duplicated by WPML or translated separately)

therajumandapati commented 8 years ago

Oops. Unfortunately I do not have a db dump. But I have an opportunity to see this issue again, and when I do I'll take a db dump and send your way.

Thanks, Raju

On Aug 30, 2016, 5:49 AM -0500, Srdjan Jocic notifications@github.com, wrote:

@mvpspl619 (https://github.com/mvpspl619) I tried to replicate issue upgrading Pods from 2.6.6 to 2.6.7 but cannot confirm issue you reported. Fields are there (registered).

Is there a chance that you have DB dump from point where issue is exposed? Or any other info that might help to reproduce? (e.g. are posts duplicated by WPML or translated separately)

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub (https://github.com/pods-framework/pods/issues/3727#issuecomment-243402720), or mute the thread (https://github.com/notifications/unsubscribe-auth/AFTEPcqZhUlnI3EcwhxcmmbbRYs4wSprks5qlAq0gaJpZM4Jl3xS).

quasel commented 6 years ago

Sorry for the late reply, feel free to comment if you still have questions, but we're closing this due to inactivity!

As it seems it couldn't be reproduced by @srdjan-jcc!