I am working on an application which will co-exist with Moodle. From this application, I need to create new accounts, and associate the "student" accounts with their "parent" accounts.
I have successfully created the accounts in Moodle from the other system. I have also created the "parent" role in Moodle. Where I am encountering a problem is in assigning the "parent" role relative to the student.
I can assign the parent Moodle account to the "parent" role, by adding rows to mdl_user and mdl_role_assignments. However, I have a question about the mdl_role_assignments.contextid, and the "path" in the mdl_context table.
mdl_context has the following columns:
I understand "id" (table row id, which appears to be used in mdl_role_assignments.contextid), "contextlevel" (30 = user context), and"instanceid" (the user ids of the two acounts). The "depth" column appears to be the number of levels in the "path" value.
So I have two questions:
How does the mdl_context.id value relate to the mdl_role_assignments table, and how is the mdl_context.path value generated?
Please let me know if I can provide any more information about what I am trying to accomplish.