How can I alter the query for user search (using normal Drupal search) so that instead of searching only email and username, it will also search custom user fields (from fields module)?

  • Which search? normal Drupal search/SOLR/Search API Jul 6, 2013 at 1:27
  • Normal Druapl search
    – user14980
    Jul 6, 2013 at 16:17

2 Answers 2


For the normal Drupal search you can do so by defining a custom search type in a module.

Use hook_search_info() to define your custom search type & hook_search_execute($keys = NULL, $conditions = NULL) to create or extend your search query.

More available hooks can be found at the Drupal's Search interface or by looking up the search contrib module under yourdrupal\modules\search\search.api.php


What you need to do is install the Search api module

And upon enabling the module, go to admin/config/search/search_api, and click add index. Add an index of item type user. Once that is done all custom user fields will be listed with a checkbox in front of them. Select the fields you want indexed and this would then make custom user fields searchable.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.