简体   繁体   中英

How to log in as specific role in Moodle

I have three roles: admin, instructor (combination of teacher and course creator) and student.

I created a child theme based from clean theme. In my child theme, I customize the layout of the login page. In my login page, there are three buttons: Login as Admin, Login as Instructor and Login as Student.

How can I force the login to be as specific role? I did check out the /login/index.php but I'm having a hard time understanding the flow of the login process.

For an additional info, the dashboard content and design depends on what role the user logged in.

First, San is wrong. There are very much global roles in Moodle. You can access these under:

Site Administration -> Users -> Permissions -> Assign system roles

Second, you talk about 'forcing' a role when you login. This makes no sense in Moodle terms. This is how Moodle works:

  1. Create a user.
  2. Assign them a system role (by default they will be under the role 'All Users')
  3. Login as that user and they will have that role.

Why bother creating three different login buttons? All you need to do is create three accounts, each with different login details, and assign them each a separate role.

If this does not answer your question please give me more details on what you are trying to achieve?

First, there is no global role in Moodle for any user.

User roles are assigned to course level in Moodle.

For dashboard content and design you can check user course level role and show data as per user role.

If a user is a student in any course then, I consider it as a student and show data related to a student only for a course in which user is a student.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM