Moodle

Searching by username

Details

  • Type: New Feature New Feature
  • Status: Closed Closed
  • Priority: Minor Minor
  • Resolution: Fixed
  • Affects Version/s: 1.6, 1.7, 1.8, 1.9
  • Fix Version/s: 1.9
  • Component/s: Administration
  • Labels:
    None
  • Environment:
    All
  • Database:
    Any
  • Affected Branches:
    MOODLE_16_STABLE, MOODLE_17_STABLE, MOODLE_18_STABLE, MOODLE_19_STABLE
  • Fixed Branches:
    MOODLE_19_STABLE

Description

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

  1. datalib.php
    13/Sep/06 6:34 AM
    106 kB
    Anthony Borrow
  2. datalib.php.diff
    31/Aug/07 10:30 PM
    0.7 kB
    Anthony Borrow

Issue Links

Activity

Hide
Martin Dougiamas added a comment -

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.

Show
Martin Dougiamas added a comment - 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.
Hide
Anthony Borrow added a comment -

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.

Show
Anthony Borrow added a comment - 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.
Hide
Anthony Borrow added a comment -

/lib/datalib.php

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

Show
Anthony Borrow added a comment - /lib/datalib.php Here is a what I would recommend - I think it is a more complete fix than what I had previously suggested.
Hide
Dariusz Górka added a comment -

I am also waiting for including this in official 1.6

Thanks for all

Show
Dariusz Górka added a comment - I am also waiting for including this in official 1.6 Thanks for all
Hide
James Ballard added a comment -

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.

Show
James Ballard added a comment - 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.
Hide
Anthony Borrow added a comment -

I'm attaching the diff I use for 18STABLE - Peace - Anthony

Show
Anthony Borrow added a comment - I'm attaching the diff I use for 18STABLE - Peace - Anthony
Hide
Anthony Borrow added a comment -

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

Show
Anthony Borrow added a comment - 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
Hide
Anthony Borrow added a comment - - 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

Show
Anthony Borrow added a comment - - 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
Hide
Helen Foster added a comment -

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.

Show
Helen Foster added a comment - 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.
Hide
Anthony Borrow added a comment -

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

Show
Anthony Borrow added a comment - 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
Hide
Helen Foster added a comment -

Thanks to GSOC student Andrei Bautu and Yu Zhang for user management improvements in Moodle 1.9

Show
Helen Foster added a comment - Thanks to GSOC student Andrei Bautu and Yu Zhang for user management improvements in Moodle 1.9
Hide
Petr Škoda (skodak) added a comment -

The bulk/upload code was further improved/rewritten later
adding some links to bugs

Show
Petr Škoda (skodak) added a comment - The bulk/upload code was further improved/rewritten later adding some links to bugs

Dates

  • Created:
    Updated:
    Resolved: