Skip Navigation

[Resolved] User View doesn’t filter by custom user field

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

Problem:
The user is using a checkboxes custom field for users.

He then created a view of users and applied a query filter on this field, but their results were wrong.

Solution:
First of all, the checkboxes field should not save 0 when an option is not selected.

Checkboxes fields are saved as a serialized array where each selected option has a unique ID and a value. Check this screenshot https://prnt.sc/131l2xn

It turns out that the user was importing the values of the checkbox from a user-made XML file instead of a Toolset Export. This file was using unique IDs, built from the same base and an incremental suffix.
This makes the view fails, because it use SQL LIKE "%option-ID%"

This support ticket is created 2 years, 11 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.

No supporters are available to work today on Toolset forum. Feel free to create tickets and we will handle it as soon as we are online. Thank you for your understanding.

Sun Mon Tue Wed Thu Fri Sat
9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 - - 9:00 – 13:00
14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 - - 14:00 – 18:00

Supporter timezone: Africa/Casablanca (GMT+00:00)

This topic contains 15 replies, has 2 voices.

Last updated by Jamal 2 years, 11 months ago.

Assisted by: Jamal.

Author
Posts
#2059889

My issue is resolved now. Thank you!

You where right, I rebuilt the checkboxes custom field (actually, I had imported them by an XML that I built myself, maybe there was some wrong reference there) and now it works.

I also changed the condition to "in" instead of "like" as you did onyour test website, so it works fine with multiple values.

cheers

#2059893

Jamal
Supporter

Languages: English (English ) French (Français )

Timezone: Africa/Casablanca (GMT+00:00)

Awesome! I am glad I could help.

It's good to know about the import. Checkboxes are stored as a serialized array, where each option has a unique ID generated when adding the options to the field definition.

Thank you for your feedback.

This ticket is now closed. If you're a WPML client and need related help, please open a new support ticket.