When using the search form, by default Drupal searches Content nodes, and there's a toggle to search Users (search/node vs. search/user). But the search/user appears to only search the default fields for the User nodes (username and email). I've added additional fields (Admin > Config > People > Manage Fields) to User nodes, but those don't get searched. How can I make the default search/user find users by those additional fields?

2 Answers 2


As far as I know, the easiest way to do this is with views. You can set up a user view with exposed filters for any user field that you need to search. If you want to get a link to your your view on the search page form then, a form alter in a custom module would do it. Obviously make sure your view has a page with a proper path setup. search/your_view etc will work.

Here is a quick example of adding a custom markup field to the search form in drupal 7.

function CUSTOMMODULENAME_form_alter(&$form, $form_state, $form_id) {

 if ($form_id == 'search_form') {

   $form['usercustomsearchlink'] = array(
  '#type' => 'markup',
  '#markup' => '<a href="http://YOURSITE.com/search/YOURVIEWNAME">Search User Fields</a> ',
  '#weight' => 1,


That should put a link underneath the search box on the form (after a cache clear). However, I havent been able to figure out how to make it appear only on search/user pages yet so, that link will appear on all search forms.


I recommend to use Search by Page module. You can search user fields by adding which roles are to be added to index and which role is to be used when doing the indexing. The results are added to the default search page by adding another search tab in addition to "Content" (nodes) and "Users".

This module also has an API to help add other things to index. But making user fields searchable can be done with configuration alone via included sub-module.

Search by Page:

This module is an enhancement to the core Drupal search module, which adds a new tab to the core Search page or can also be used in stand-alone mode. The differences between Search by Page and the existing tabs in the core Search module lie in what is indexed for searching and how it is indexed:

  • Search by Page indexes the content of your pages as rendered by your theme (Search indexes the default rendering you would have from an unmodified theme).

  • Search by Page allows you to omit content from indexing (such as "database table" node types that should never be viewed as stand-alone content).

  • Search by Page allows you to index non-Node pages, including user profiles, file attachments, and Views.

  • Search by Page is language-aware, so it only shows you results in the current language.

  • Search by Page has multiple search "environments", so you can have different search pages/blocks to search different things.

Search by Page does not know what the pages of your site are, so it doesn't index anything by itself. You will need to enable and configure at least one sub-module that lets you add paths to the search index, in order for this module to do anything.

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.