lewismcarey / User-Field-ACF-Add-on

User Field Add on for Advanced Custom Fields
40 stars 19 forks source link

Using "Filter By Role" always returns empty #3

Closed Synaestesia closed 12 years ago

Synaestesia commented 12 years ago

Hi,

this is a very nice plugin, but I found a issue in "filter by role". I am working with the italian translation of Wordpress, and the query at line 225 ($users = get_users( $args )) always returns an empty array. I notice that also the values of the select field are the translated ones, and I think this could be the reason.

Thank you,

Fabio

lewismcarey commented 12 years ago

Hi Fabio,

Thank you for pointing this out. I have had a prior issue with translation and I am grateful for you help. If you could answer the following, while I investigate the issue:

Can you confirm you are using this latest commit? Which values are translated? The filter by role values...E.G. line 92?

Thank you

Synaestesia commented 12 years ago

Yes, I am using the last commit, and the translated values are exactly the roles specified in line 92. In fact simply removing the translation from the array $choices partially resolve the problem($choices[$name] = $name;): get_users( $args ) returns the correct items, but obviously the user role are no more translated.

Thanks!

PS. I am very new to this kind of discussion on GitHub. I am sorry if I am missing some of its conventions; and of course I am sorry for my poor english.

lewismcarey commented 12 years ago

Thanks Fabio.

I just need to work out how to translate the name without translating the value and I will be able to fix.

Thank you for your help and I will post when I have an update.

lewismcarey commented 12 years ago

Hello Fabio,

On Lines 84 & 85 ...

line 84: $name = translate_user_role($details['name'] );
line 85: $choices[$name] = $name;

Please can you try replacing with

line 84: $choices[$details['name']] = translate_user_role( $details['name'] );

And let me know if that works please.

Thank you.

lewismcarey commented 12 years ago

Hello Fabio

I have added this to the latest commit, can you test before I close this issue please.

Thank you.

Synaestesia commented 12 years ago

Hi,

it works perfectly, thanks for your effort!

Fabio