Assigning all users the "Student" role on import

Assigning all users the "Student" role on import

by Brian Maynes -
Number of replies: 2

We are using External Database authentication (Moodle 1.7.1) for all user accounts. Currently, we have 1800+ user accounts in the mdl_user table (auth=manual).

When I go to Administration > Users > Permissions > Assign roles and attempt to assign all users the "Student" role, it only adds 132 users at a time. Is there any way to assign ALL users at once during the import...am I missing something here?

My reason for doing it this way are based on the following:

1. We have only 2-3 administrator users in the system.
2. We have only ~20 trainers

By assigning all users the "student" role, I'm hoping I can then go in and cherry pick the 23 or so users that will be assigned to other roles...admin, trainer, etc. and assign them to other roles. This would be much easier than going through 1800+ users and assigning each a role individually. I'm sure I'm missing something pretty basic here.

Also, how do I assign roles during user import into my database? I currently import all user accounts using uploadusers.php and a .csv file which populates the mdl_user table nicely. However, role assignments are stored elsewhere in the database. How can I kill two birds with one stine here...import all users and assign all appropriate roles based on the criteria described above?

Any insight would be greatly appreciated.

Kind regards,
Brian

Average of ratings: -
In reply to Brian Maynes

Re: Assigning all users the "Student" role on import

by Helen Foster -
Picture of Core developers Picture of Documentation writers Picture of Moodle HQ Picture of Particularly helpful Moodlers Picture of Plugin developers Picture of Testers Picture of Translators
Hi Brian,

If you assign all users the role of student via Administration > Users > Permissions > Assign roles then everyone will be enrolled in all courses. Is this what you require?

You may wish to consider instead setting the default role for users in a course to "Student" via Administration > Users > Permissions > User policies.

Regarding assigning roles during user import, please note that the flat file enrolment plugin in Administration > Courses > Enrolments enables roles to be set.

In reply to Helen Foster

Re: Assigning all users the "Student" role on import

by Brian Maynes -

Thanks for your reply, Helen!

I'll take a look at the options you mention above in more detail.

"If you assign all users the role of student via Administration > Users > Permissions > Assign roles then everyone will be enrolled in all courses. Is this what you require?"

Yes. This is what I'd like to do...however, when I try and assign all 1800+ users the "Student" role in this manner, it only assigns the role to 132 users at a time. This would make for a lot of admin to assign everyone the "Student" role. That is why I asked about setting roles for all users during import.

Thanks again,
Brian