Skip Navigation

[Resolved] Search users in Views

This support ticket is created 3 years, 2 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: Asia/Hong_Kong (GMT+08:00)

This topic contains 1 reply, has 2 voices.

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

Assisted by: Luo Yang.

Author
Posts
#2162631

Dears,

I have a user form, all its fields are created in custom user fields. I would like to add search boxes in the user view to be able to search the user by, for example, Name, ID, or email.

I discover that Only Views listing posts can have custom search inputs.

What is the solution now, Is there any other way to solve it. Please assist me.

#2162661

Hello,

There isn't such a built-in feature within Toolset Blocks/Views plugins, you will need do these manually:
1) Manually setup the search input fields and submit button, when user click the submit button in front-end, it will pass specific URL parameter to the view.
2) Use filter hook "wpv_filter_user_query" to trigger a PHP function
https://toolset.com/documentation/programmer-reference/views-filters/#wpv_filter_user_query
3) In this PHP function, get the URL parameters, and apply it to the WordPress user quer:
https://developer.wordpress.org/reference/classes/wp_user_query/