[Resolved] WPML can't translate added user fields content

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.

This topic contains 9 replies, has 2 voices.

Last updated by Luo Yang 3 years, 9 months ago.

Assigned support staff: Luo Yang.

Author
Posts
#436157

Hi, I added a user fields group (or for the sake of it, a single user field has the same issues) and in the user profile I have that user field WYSIWYG, called 'seller info'. It's available for vendors only, and admin writes some general info about that vendor for the public to see, in here.
The site is in 4 languages.
I echo the content of this field into a woocommerce product tab. (but for the sake of it, the same issue exists when adding it by fields & views or however else)
FYI: this is part of function.php where i did so:
function woo_new_product_tab_content() {
// The new tab content
echo do_shortcode('[types usermeta="seller-info-product-tab" user_is_author="true"]');
}

Problem: while the main language shows the content frontend correctly as expected, there seems to be no way to show the content in other language versions. Everything is translatable somewhere, but the content of that field isn't. Switching language where I work in doesn't solve anything, (expected).

Question: so how does somebody get to have multiple language versions of user data?? I can hardly believe that wouldn't be possible (that would be major upset 🙂 ?

In case of no better solution: how should i rewrite the above code so that it would be language dependant (i saw some Conditional language shortcode and even a plugin, both 3 years old and probably very outdated - and i'm not even sure if that would be possible to use in my little code above)

Thanks for your help! (i'm working with toolset 2 weeks and surprisingly the wpml integration i find to be one of its weaker spots, it's all over the place)

#436394

Luo Yang
Supporter

Languages: English (English ) Chinese (Simplified) (简体中文 )

Timezone: Asia/Hong_Kong (GMT+08:00)

Dear Filip,

Yes, you are right, It's not possible to translate value of Custom User Fields created by Types with WPML yet.

This has already been filed as a feature request, and I have added this thread into it, hope this can raise attention.

#436461

hi, that's a real hurt right now for us, in regard with finishing one project (and the next one as well, actually).
Can you advice a way how we can achieve our goal without using 'user fields'? How would you recommend to proceed in the best way?
Perhaps you can also make a recommendation on solving that little code with conditional wpml?
(that would solve this project, but not the next one)

Could you please inform us on that feature request, if your colleagues have a date foreseen? We need to know if that would be done within the next 4 weeks, or not - for the structure of the next project. This looks to me more like a basic feature what wouldn't need a request to be implemented, it has so much potential in many sorts of sites... 😉
Thanks!

#436462

sorry, i should add the reason we need this:
this (complex) site was not build with toolset form the beginning, but we bought toolset to add some functionality to it (it makes use of CMB2 otherwise, which i can't work with).
In this context, we'd need to translate those user fields, instead of doing it a different way from the start of the build up.

#436686

Luo Yang
Supporter

Languages: English (English ) Chinese (Simplified) (简体中文 )

Timezone: Asia/Hong_Kong (GMT+08:00)

There are lots of similar request in WPML forum, for example:
https://wpml.org/forums/topic/translate-custom-user-meta-help-needed/#post-660947
https://wpml.org/forums/topic/wpml-and-user-meta-with-views/
https://wpml.org/fr/forums/topic/user-fields-translation-menu-switch-issue-on-author-page/
...
As I mentioned above, it is in our to-do list as a feature request, which is in "Waiting evaluate" status, and there isn't any ETA for it.

Currently, you can try this:
Create a custom post type, setup each post's author as different user, setup the custom fields into the post type.
1) You can use Views to get the posts whose author is current user:
https://toolset.com/documentation/user-guides/filtering-views-query-by-author/
2) Translate the custom fields value with WPML

#437545

thanks, i'll try that as an sos solution for now

#437826

Luo Yang
Supporter

Languages: English (English ) Chinese (Simplified) (简体中文 )

Timezone: Asia/Hong_Kong (GMT+08:00)

OK, please let me know if you need more assistance for it, thanks

#438952

Well that didn't work out (yet).
Problem is that in the new post type, there's no option to connect it to the correct author. Sure there is the author field, but there are just 3 choices (the 3 admins) while the vendors (that's a specific role with limited abilities and i shouldnt give more privileges to them) are not selectable in the author field.
When I make WC products, the 'vendor' is selectable nicely.
So than: how can i add to the custom type that 'vendor' selection. Don't think it's that hard but i dont see it 😉

PS this is a workable temporary solution (if that vendor/author selection will work) to the problem of user fields not being translatable; but surely it make thing much more complex to the client as they have to do things double time instead of on one page. Please push that to the developpers, i see it's already two years on the waiting list 🙁

Thanks a lot for your help!

#439032

FYI: it does work after i tested with changing (secundary) user role to 'author', but i must still test what consequences that has, as i never used secundary roles before and don't know (anything) about its actual function (google didnt help)

#439133

Luo Yang
Supporter

Languages: English (English ) Chinese (Simplified) (简体中文 )

Timezone: Asia/Hong_Kong (GMT+08:00)