Web services

core_user_get_users_by_field return blank array

Picture of Tim Titchmarsh
Re: core_user_get_users_by_field return blank array

Hi Surmit

there are several solutions that I found:

1. Give the webservices login account admin rights, you then get all the fields

2. You can get some fields by turning them on in the profile, email for example

It seems hit and miss to find out what fields you can get, not sure why you would restrict them but I guess its part of the bigger permissions picture.

The searching needs to have these fields enabled as well, so if you want to search by username then you must have this field returned as well. the only way I found of getting/searching by username for example was to give the web service account admin rights which seems a bit overkill!

Good luck

Average of ratings: -
Picture of Sumit Tayal
Re: core_user_get_users_by_field return blank array

Thanks, Tim for pointing out the direction.

Managed to get it working by providing the following permission to Webservice User


Average of ratings: -
Picture of biboy atienza
Re: core_user_get_users_by_field return blank array

I am trying to pull user details using core_user_get_users, using email and id it's working OK, but how to use it if I have a additional field "Person No | personno"?

Getting user details by email address: OK




Getting user details by id: OK




But how to get user details using below optional field/User profile fields| Additional Information? => Person Number/personno with value of 210792



     <KEY name="type">



     <KEY name="value">



     <KEY name="name">

          <VALUE>Person Number</VALUE>


     <KEY name="shortname">






Average of ratings: -
Picture of Jose Lorenzo Espeso
Re: core_user_get_users_by_field return blank array

Yes, this is the solution. Thank You! Give the capacity "Moodle/user:viewalldetails" to the rol of web services.

Average of ratings: -