Hi to everyone,
I commented what is the "problem" I have in my Moodle platform in version 3.1.6.
I have been investigating if there is a possibility that a user with a
"student" role does not have permission to edit the name and surname in
the edition of their profile. I have looked at the
restrictions at the role level and there is no such thing as the
restriction to prohibit editing the profile itself.
my question is, how can I do, at the code level, prevent a user with a
student role from modifying neither his name and lastname, and that
those two boxes in the profile appear with the readonly property?
Thank you very much in advance.
It may depend where they are being set from initially - if you are using one of the external authentication methods (eg. LDAP, external database, etc) then the mapped fields can be locked in those settings.
However, if you are using self-registration of some sort then this might be difficult as you would need to allow them to create it and then not allow them to edit it. Otherwise you may need to dig into the code to find out how the external methods lock it down and write some code based on that (someone else may be able to give more advice in that area - I've only used the restrictions from the authentication methods myself).
Thank you very much for the solutions provided. These solutions are based on the configuration of authentication methods (LDAP, CAS ...), and may or may not block the fields we want is a generic solution, since it applies to all system roles. The ideal and what I am looking for is that only users with a student role can not edit their profile (name and surname) but any other user with another role, for example, teacher role or course creator, can modify name and last names of the students.
Anyway, thank you very much for the instructions.