I'm developing an external Moodle v2.5 web services library in python for my thesis.
I created a web service with all no deprecated functions and I had no problems to use any of them until I tried to use the core_message_search_contacts function.
When I use this function with a search string that matches with any result, I get a HTTP 500 internal server error. When I searched in my apache web server log file I found this:
PHP Fatal error: Call to undefined function user_get_user_details() in /var/www/moodle/message/externallib.php on line 540
Looking in the specified file I saw that user_get_user_details() is a function defined in /user/lib.php, but no "require" sentence appears in search_contacts function.
So I added this line after the "require_once($CFG->libdir . '/enrollib.php');" sentence (line 501), at the begining of the search_contacts function:
require_once($CFG->dirroot . '/user/lib.php');
and everything started going fine.
I'm new in php but I think that this is neccesary in order to that this function works well.
If I'm wrong I would like to know what should I do to work with this function or why I get this 500 internal server error.