Issue Details (XML | Word | Printable)

Key: MDL-3982
Type: New Feature New Feature
Status: Resolved Resolved
Resolution: Fixed
Priority: Minor Minor
Assignee: Martin Dougiamas
Reporter: Imported
Votes: 2
Watchers: 3
Operations

Add/Edit UI Mockup to this issue
If you were logged in you would be able to see more operations.
Moodle

Searching by username

Created: 26/Aug/05 11:28 PM   Updated: 14/Jan/08 01:44 AM
Return to search
Component/s: Administration
Affects Version/s: 1.6, 1.7, 1.8, 1.9
Fix Version/s: 1.9

File Attachments: 1. Text File datalib.php (106 kB)
2. File datalib.php.diff (0.7 kB)

Environment: All
Issue Links:
Relates

Database: Any
URL: http:///llib/datalib.php
Participants: Anthony Borrow, Dariusz Górka, Helen Foster, Imported, James Ballard, Martin Dougiamas and Petr Skoda
Security Level: None
QA Assignee: Helen Foster
Resolved date: 27/Dec/07
Affected Branches: MOODLE_16_STABLE, MOODLE_17_STABLE, MOODLE_18_STABLE, MOODLE_19_STABLE
Fixed Branches: MOODLE_19_STABLE


 Description  « Hide
We would like to have the ability to search on username for an administrator. This will give a single return rather than multiple returns when searching on lastnames

 All   Comments   Change History   Version Control      Sort Order: Ascending order - Click to sort in descending order
Martin Dougiamas added a comment - 08/Aug/06 12:03 AM
From Gustav Delius (gwd2 at york.ac.uk) Saturday, 27 August 2005, 02:04 AM:

Clicking on 'Users' in the 'Administration' block on the Moodle home page and then on 'Edit user accounts' brings you to a list of all users on the site with a search box which also searches on usernames.

Or did I misunderstand this feature request?

From Reed Law (reedlaw at gmail.com) Monday, 17 October 2005, 04:46 PM:

I just checked this and the search does not include usernames, only First Name and Last Name fields.

From Anthony Borrow (aborrow at jesuitcp.org) Sunday, 14 May 2006, 04:39 AM:

I also would like to have this functionality. Currently, as of 1.6 beta 5 the /lib/datalib.php contains a function get_users_listing where around line 1810 it currently sets the value of the $select variable as follows:

$select .= AND ($fullname $LIKE '%$search%' OR email $LIKE '%$search%') ;

as you can see this is just the first and last name field that is being searched. We use a five digit student id to identify our students and sometimes it would be helpful to search by the student id. In particular I am thinking of how to check which student is having login failures from the logs.

I have customized the code on my production server with:

$select .= AND ($fullname $LIKE '%$search%' OR email $LIKE '%$search%' OR username $LIKE '$search%') ;

Ideally I would like to limit the number of customizations and hence I am re-opening this feature request. To that end, I have changed the version from 1.5.2 to 1.6 beta 5 and the OS from Solaris to all. I also changed the resolution from works for me to reopened. Thank you for your consideration and for all you do to make Moodle Moodle-tastic!

From Anthony Borrow (aborrow at jesuitcp.org) Tuesday, 8 August 2006, 12:03 AM:

Martin - I have changed the to be closed in version to 1.7 as I think this would be a nice, easy addition to 1.7. The code change is very minor and included in the feature request. It is just a matter of writing it to CVS. Thanks for your consideration - Anthony.


Anthony Borrow added a comment - 13/Sep/06 06:32 AM
I went through and changed a number of places in the /lib/datalib.php where it was creating a $search string so that it would also search the username field. I would propose that these be included. I will see if I can find a place to upload my suggested changes.

Anthony Borrow added a comment - 13/Sep/06 06:34 AM
/lib/datalib.php

Here is a what I would recommend - I think it is a more complete fix than what I had previously suggested.


Dariusz Górka added a comment - 13/Dec/06 07:10 PM
I am also waiting for including this in official 1.6

Thanks for all


James Ballard added a comment - 31/Aug/07 06:43 PM
This is still not working for 1.8.2 as far as I can tell. There are lots of instances where username and idnumber are more relevant search criteria then name or email as unique identifiers. Other categories may be altered by the user to reflect user preferences (such as Anthony shortened to Tony) and so are less reliable.

Ideally both should be included but idnumber is seems the more relevant field as most enrolment features utilise this and it is often directly tied to other systems.


Anthony Borrow added a comment - 31/Aug/07 10:30 PM
I'm attaching the diff I use for 18STABLE - Peace - Anthony

Anthony Borrow added a comment - 17/Sep/07 11:59 PM
Martin - The ability to search for users by username has been floating around for a while. Any thoughts on what you might like to do with this. I've also done a similar modification to /admin/roles/assign.php to search the username field. A neat improvement would be to allow the user to select which user fields (including the new user defined profile fields) they would like included to be searched for. That would give the site admin control to search as best works for that particular site without having to modify the code. If you would like me to work on developing a patch to accomplish this let me know but I don't want to put in the time or effort if it is not going to be used. This issue re-surfaced in http://moodle.org/mod/forum/discuss.php?d=78904. Peace - Anthony

Anthony Borrow added a comment - 26/Dec/07 06:31 AM - edited
Martin - Can you see any reason not to include the ability to search on username in 1.9? It increases the functionality greatly and just seems to make sense. It comes up periodically in the forums. I'm providing the patch to yet another user which is when I come back to this issue. Peace - Anthony

Helen Foster added a comment - 27/Dec/07 12:56 AM
Hi Anthony,

Please note that a username search is already included in Moodle 1.9 via Administration > Users > Accounts > Browse list of users or Bulk user actions.


Anthony Borrow added a comment - 27/Dec/07 08:59 AM
Helen - That is great news - I've not had a chance to do much playing with 1.9 yet. Thanks for letting me know that it is already there. That being the case, we can go ahead and mark this issue as resolved in 1.9. The attached patches could be used by folks should they want that functionality in 1.8 or 1.7 Peace - Anthony

Helen Foster added a comment - 27/Dec/07 06:17 PM
Thanks to GSOC student Andrei Bautu and Yu Zhang for user management improvements in Moodle 1.9

Petr Skoda added a comment - 27/Dec/07 06:57 PM
The bulk/upload code was further improved/rewritten later
adding some links to bugs