Query user's roles in courses

Query user's roles in courses

by Rafael Rodriguez -
Number of replies: 4

Hi

I'd like to list a user and all his roles in courses.

e.g.

user1:course1:student

user1:course1:teacher

user1:course2:teacher


cheers


Average of ratings: -
In reply to Rafael Rodriguez

Re: Query user's roles in courses

by Mary Cooch -
Picture of Documentation writers Picture of Moodle HQ Picture of Particularly helpful Moodlers Picture of Testers Picture of Translators

You can get this from their profile, from their Preferences page >This user's role assignments if you are the administrator. 

In reply to Mary Cooch

Re: Query user's roles in courses

by Rafael Rodriguez -

Sorry, I should have been more specific.

I'd like to export a list of users with all their roles in all their courses.

In reply to Rafael Rodriguez

Re: Query user's roles in courses

by Ron Meske -
Picture of Particularly helpful Moodlers

@Jack,

Not sure which version of Moodle you are using, but there are two plug-ins that will allow you to create a report to do this.

  1. Ad-hoc database queries
  2. Configurable Reports

The configurable reports has the ability of building reports without knowing SQL, so that may be your best choice.  However, if it does not have the options you are looking for both support custom SQL queries.  You can find a number contributed reports that may have enough information you can piece together the report you are looking for.  The are located at: ad-hoc contributed reports.

I recommend starting with

3.19 All users enrolled in a course without a role

Ron