[development] admin user search by email patch

Damien Norris damien.norris at gmail.com
Fri Jun 22 15:50:14 UTC 2007


Hello Drupal developers!

This is my first post to this list and I apologize up front if i am  
suggesting something newbish or stupid or going about this the wrong  
way... but here goes!

I would like to propose inclusion of a small patch to user.module,  
which extends /admin/user/search so that if you have "administer  
user" permissions, your search string will match against e-mail  
addresses as well as just usernames.  I looked at the DEP  
documentation and I think tihs is probably simple enough to propose  
here in email, as there is a patch ready...

--First, the rationale for this:
One of my customer's most popular drupal sites has 5000+ users.    
While there IS a forgot password feature for helping users who lost  
their password or usernames find them, there is no way for an  
administrator to help when the user contacts them directly.   While  
it would be nice to assume that all users can manage using the forgot  
password link, It has been our direct experience that many users  
can't or won't - they contact the site admins instead for help, and  
then there is no way to find their username from their email  
address.   Without going into the database and running a SQL query  
there is no way for the administrator to glean the user's Drupal  
username.  (is there a way I don't know of?)

I did some digging on Drupal.org and found mention of an old  
user_search module from 4.6 (not ported beyond) and also some people  
working on profileplus for better profile searching support.  But  
AFAIK this won't include email addresses, which are in the users table.

When I went to huntfor a solution I discovered someone had made a  
patch to do this, but the patch wasn't up to date.  I updated it to  
work against HEAD and also changed it to modify the help text so it  
works as follows:

--New Behavour with the patch applied:

For all non-admin users, everything is the same... the text box  
searches for a username and the help text reads:

Enter a simple pattern ("*" may be used as a wildcard match) to  
search for a username. For example, one may search for "br" and  
Drupal might return "brian", "brad", and "brenda".


But if you have 'administer users' permissions, the search will also  
search on the user.mail field, and the help text instead reads:

Enter a simple pattern ("*" may be used as a wildcard match) to  
search for a username or e-mail address. For example, one may search  
for "br" and Drupal might return "brian", "brad", and  
"webmaster at brenda.com".


That's it!  The patch itself is as simple as it sounds...

So my question for you folks is:  what now?     After my initial  
patch wasn't up to coding standards and I corrected it, the issue  
died on the vine.  How do I move it forward from here?  I guess first  
and foremost is to get more people to try testing it - where do I go  
to drum up more testers?  Or what should be my next step?

Here is the link to the latest version of the patch, user_search- 
by_email-HEAD_2.patch
http://drupal.org/node/113983#comment-249183

I understand more steps may be required and it may take way loner  
than the code freeze has left... but I am just unsure how to get it  
moving forward again.  Advice would be appreciated... Thanks!

D.






More information about the development mailing list