enroling users in courses and groups with soap

enroling users in courses and groups with soap

by Andre Clements -
Number of replies: 1

Hi

I use webservices (SOAP) to create users, and groups in courses successfuly.

When trying to use 'moodle_group_add_groupmembers' things get stuck.

 

The code:

$members = array();
$params = array();
while ($individual = $db->fetchByAssoc($individuals)) { //we'r in sugarcrm

$member = new stdClass();
$member->groupid = intval($individual['moodle_regen_group_id']);
$member->userid = intval($individual['m_studnt_id']);
$members[] = $member;
}
$params = array('members'=>$members);
var_dump('<br>params',$params);
$responses = $client->call('moodle_group_add_groupmembers', $params);
var_dump('<br><br>moodle_group_add_groupmembers response', $responses);

Using the test client also doesn't give any meaningfull response and doesn't seem to do anything when submitting similar values.

gives the response:

params" array(1) {   ["members"]=>   array(1) {     [0]=>     object(stdClass)#72 (2) {       ["groupid"]=>       int(65)       ["userid"]=>       int(333)     }   } } string(46) "

moodle_group_add_groupmembers response" array(2) { ["faultcode"]=> string(8) "Receiver" ["faultstring"]=> string(61) "Invalid parameter value detected, execution can not continue." }

Ive not seen another service to  add users to a course, so I've asumed if you have a course and a croup in that course, and add a user to that course they'll be automatically enrolled for that course - or is this wishful thinking?

Thanks in anvance for any kind assistance.

Average of ratings: -