Exporting Roles for use in other moodle sites

Exporting Roles for use in other moodle sites

by Simon Britton -
Number of replies: 2
Does anyone have any pointers to being able to export a set of created roles for importing into other moodle sites? A mysql dump of the correct table will do it? if so can anyone tell me which tables are required so I can experiment?
Average of ratings: -
In reply to Simon Britton

Re: Exporting Roles for use in other moodle sites

by Greg Lyon -
Right off the top of my head, the tables you want are mdl_role and mdl_role_capabilities.

mdl_role is pretty straight forward, just lists each defined role by id, name, shortname and description as well as sortorder.

mdl_role_capabilities goes on to describe all the capabilities that each role has been assigned.

Couple thoughts on the topic...
If you're overwriting ALL ROLES from one moodle to a brand new installation (of the same version) this may actually be pretty straightforward, but if you're hoping to add roles to existing moodles proceed with caution (to say the least).
Average of ratings: Useful (1)
In reply to Greg Lyon

Re: Exporting Roles for use in other moodle sites

by Simon Britton -
I will be upgrading 8 moodle sites using the delete moodle folder, CVS in the new version then copying the config file into the new moodle folder method. They will be upgraded from 1.63+ but I am assuming that the newly upgraded 1.7 sites will all have the default roles in the mysql tables so I don't see an issue.

Thanks for the info, I will attempt it on a test site first to see if it has any adverse effects.