Jason Noble wrote "If anyone is still looking for a solution for this problem, my company has published our XML-RPC module."
Jason, I have a couple of question about the SML-RPC module...
QUESTION #1
If I use CreateAccount, I receive SUCCESS, and if I try CreateAccount again (with same info), I get FAIL: USER ALREADY EXISTS, which is what I should get. If I login to Moodle, I can confirm as well that the new user has been created.
But if I try DisableAccount, I get the following error: FAIL: USER DOES NOT EXIST. Since the user does exist, I'm not sure why I'm getting this error:
Here is the code I'm using for CREATE (which works fine), based on the test file provided:
<?phpinclude("../config.php");include("xmlrpcutils/utils.php");$host = $CFG->dbhost;$port = 80;$uri = $CFG->wwwroot."/xmlrpc/xmlrpc.php";$method = "CreateAccount";$m_user['username']='testuser';$m_user['firstname']='John';$m_user['lastname']='Doe';$m_user['email']='johndoe@mydomain.com';$m_user['timemodified'] = time();$m_user['password'] = md5('password');$m_user['confirmed']=1;$callspec = array('method' => $method,'host' => $host,'port' => $port,'uri' => $uri,'user' => 'username','pass' => 'password','secure' => false,'debug' => true,'args' => $m_user);$result = xu_rpc_http_concise($callspec);print_r($result);?>Here is the code I'm using for DISABLE. All I've done is change the METHOD to DisableAccount, and removed all $m_user variables except for the USERNAME.
<?phpinclude("../config.php");include("xmlrpcutils/utils.php");$host = $CFG->dbhost;$port = 80;$uri = $CFG->wwwroot."/xmlrpc/xmlrpc.php";$method = "DisableAccount";$m_user['username']='testuser';$callspec = array('method' => $method,'host' => $host,'port' => $port,'uri' => $uri,'user' => 'username','pass' => 'password','secure' => false,'debug' => true,'args' => $m_user);$result = xu_rpc_http_concise($callspec);print_r($result);?>Any idea why it's not working? Do I need to pass other variables along besides the username?
QUESTION #2
Looking at the code in the XMLRPC.php file, it appears that the DisableAccountById does the same thing Moodle would do if you selected Delete User within User Admin. By that I mean it sets DELETED=1 , Changes the USERNAME=EMAIL ADDRESS, and sets the EMAIL=""
When looking at the code for DisableAccount, it does not appear to do all that. It only appears to set DELETED=1, but not perform the other changes.
I am not an expert in php, so I might be missing something obvious, but just thought I'd mention it.
THanks
EDIT: I'm using Moodle 1.6.4