Function to restore an user's role, when it was changed unintentionally by the user itself

Function to restore an user's role, when it was changed unintentionally by the user itself

by Martin Reichel -
Number of replies: 0

... and here another pitch zwinkernd,
to restore the origin role of users (teachers) automatically for those, who changed their role to student, because the tried to view the course in another role - and didn't know how to do that correct (which happens regularly).


Cheers, Martin



As an administrator (in the support wink
I want to have an automatic workflow for teachers to restore their origin role after they changed their own role unintentinally into student (because they weren't familiar with the function to "switch role to...")
to do not have to repair this manually.


Current feature

  • If a teacher doesn't know the mode to switch the role to simulate another role, often they go to "Participants" and change their own role to "student" and remove their origin role "teacher".
  • Doing that shows a message "invalid response" and afterwards they aren't allowed to change their role back, because they don't have the capability anymore (because they are now a student).


Proposed feature

  • add a function (maybe via a small local plugin) to be able to deal with this automatically
  • if a user with the capability to change a role (e.g. teacher) shouldn't be able change his OWN role to a role without that capability (e.g. student) to do that, successfully
  • this workflow shouldn't be triggered, if the user adds a further role to the own user (e.g. a dual role with teacher + student)
  • this workflow shouldn't be triggered, if the user changes the role of other users
  • if it is triggered, there might be one of the following options (which could be defined via some admin-settings):
    • option 1: show an infobox, if this is really intented to change the role permanently - or the user wants to simulate the role only (with an button to switch to this area + restore the origin role)
    • option 2: restore the origin role of the user automatically without any further information
    • (option 3: disable the function)