So the client wants to have a contact database with all their employees available in their new intranet that we are building with toolset.
We are using the built in WordPress users in order to give all employees access to the intranet.
They are like 500 users and we have added custom user fields like "Division", "Country", "Business center", "Profile image" and "Title".
Now I'm thinking that it would be great if we could create a view with custom search for this. So that it would be easy to find each person using filters.
Is it possible to create a view and filter WordPress Users like this?
If not. Is it possible to create a custom post type and relate the users to a post type somehow (to make it filterable)?
OR do you have any other suggestion on how to create this searchable contact function.
We did another site using a custom search years ago that works fine, but those persons doesn't need an user account in WP, so they are made of a custom post type called "Contacts".
Actually no its not possible to do a parametric search on Users however you can allow them to create profiles using the CPT and then search their profiles.
I've already made a solution using CPT in a previous project and it works fine (hidden link)
But for pure administration convenience this time, it would have been so much better if it was possible to use the default WP users. With CPT we'll need to add the user 2 times (one for wp-login and one for the CPT for parametric search) and as soon as an employee quits from the company, they have to remove him/her from two locations in WP.
But... can I somehow reuse data from WP users in my CPT? Like user e-mail and extra user fields etc.? Is it possible to add Users to a post type with post relationship?
If the user creates their own profiles then you won't need to re-add some of the custom fields. That is because we can get the user information through the post author.
However for the filterable information, this needs to be on the posts itself.
Users are already link to a CPT through the post author so there isn't another way to do this. Once a user is an author of a post we can pull information from their User.