by Doug Stevens.
Hey all, This seemed to work in an earlier version of moodle, but since moving to 3.7 it doesn't seem to work anymore. The purpose of this is to give parents access to their child's grade book. When I assign this role manually in the "Roles relative to this user" section of preferences it works perfectly. However, when the script creates a $roles array with the contents of:
array(528) { [0]=> array(5) { ["roleid"]=> int(9) ["contextlevel"]=> string(4) "user" ["userid"]=> int(37393) ["contextid"]=> int(36887) ["instanceid"]=> int(19846) }....
}
Where
- roleid=9 is a "user" level role to give Parents access to their child's grades.
- contextlevel="user" implies I want to give this role to a user
- userid=37393 is the confirmed userid of the Parent
- instanceid=19846 is the confirmed userid of the Student
- contextid=36887 is the confirmed context for the student with id=19846
and feed it into the following php method call ($clientm has worked for other method
calls including unrelated calls to core_role_assign_roles):
try{$resp=$clientm->core_role_assign_roles($roles);}catch(Exception$e){echo$e."\n";}
Nothing happens. No PHP errors, and the moodle log shows
"The web service function 'unknown' has been called."
Would love any help!
Thanks,
Doug