by Edgar Vargas.
I created a service for moodle with the information I found on this page http://www.spanidis.eu/?p=27 but I have a drawback, I need to create the user with the field "department" but to pass it as parameter I get error. How can I field this field?
Try it from the following:
$user1 = new stdClass();
$user1->username = $username;
$user1->password = $password;
$user1->firstname = $firstname;
$user1->lastname = $lastname;
$user1->email = $email;
$user1->auth = 'manual';
$user1->idnumber = 'numberID';
$user1->lang = 'en';
$user1->city = $city;
$user1->country = $country;
$user1->description = $description;
$user1->department = $department;
and so$user1 = new stdClass();
$user1->username = $username;
$user1->password = $password;
$user1->firstname = $firstname;
$user1->lastname = $lastname;
$user1->email = $email;
$user1->auth = 'manual';
$user1->idnumber = 'numberID';
$user1->lang = 'en';
$user1->city = $city;
$user1->country = $country;
$user1->description = $description;
$user1->customfields = array(
array('type' => 'department', 'value' => $department)
);