Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

There is many a WordPress plugin out there that enhances WordPress search but I have yet to find a plugin that will add user search.

Search Everything used to have the functionality but was removed when WP moved to version 2.8. I suspect this was due to the way WP changed how authors were stored.

The reason why I'm after user search is because all users on the WP site are staff members with their own profile. We have an author page that lists all staff by surname that is separated by 20 members per page. If you only know the first name of a member of staff then trying to find that member is very hard. I want to extend WP search so you can simply enter a name and the corresponding member shows up.

This site is an intranet so using an external search engine is out of the question.

Just want to be clear that I'm wanting to search for users not search for posts by author.

How can I get staff member search added?

share|improve this question
    
How about extending the posts hook on is_search with a WP_User_Query? –  kaiser Nov 2 '11 at 14:24

2 Answers 2

up vote 3 down vote accepted

You can't achieve this easily with WP's built-in search system. Even if you managed to build a complicated query that pulls data from the user table, it would be incredibly slow.

Search Unleashed had this functionality, but I'm not sure about compatibility with WP 3.2.

I used it in the past as inspiration to add better search functionality on my site. Basically it gathers data on content publishing hooks, which then gets indexed and stored somewhere for faster accessing, for example a custom db table, or in special files if you're using the Lucene search engine.

If you really want to go the WP way, see this question. You need to join $wpdb->users on post_author.

share|improve this answer

Solution is here: http://wordpress.org/support/topic/default-custom-fields?replies=6

A quote from one of the posters on that thread:

...just for searching for posts by a certain person, NOT a keyword + the author. In my usage I am using Kaf's plugin that i mentioned above and I have 3 radio buttons, so you can search by "author's real name", "author's username", or the default search "post content"...

share|improve this answer
    
This answer doesn't help at all. The solution given in the forum post simply adds extra data to a post about the author that published it. The code given helps searches for posts by author not searching for members of staff/users. –  Brady Nov 2 '11 at 13:31
    
But that's what it does... "...enter a name and the corresponding member shows up..." –  Roger Nov 2 '11 at 13:37
1  
But only if that author has published anything. In my case all my staff members will never publish anything. If they don't publish then their details are never added to a post meta thus they never show up in search results. –  Brady Nov 2 '11 at 13:40

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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