Unable to stop users editing their profile

Unable to stop users editing their profile

by Simon A -
Number of replies: 12
Hello Everyone,

I've been trying to stop users from editing their profile.

I changed the student roll permission called Edit own user profile to Prevent, and when logging in as that user, they can still edit their profile.

Evan if I create a second roll and I assign it to the user, they can still edit their profile.

I discovered I can lock user fields, but you can't lock the users profile picture.


The user is not assigned any roll that would allow the editing of their profile.
I'm using Moodle 1.9.1+

Any help is very much appreciated,
Simon
Average of ratings: -
In reply to Simon A

Re: Unable to stop users editing their profile

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 Simon,

Since user profiles are outside courses, changing moodle/user:editownprofile for the student role (normally given in a course) won't work. It should be changed for a system-wide role instead, such as the Authenticated user role.
Average of ratings: Useful (2)
In reply to Simon A

Re: Unable to stop users editing their profile

by Ann Adamcik -
If you're looking to prevent users from changing their profile pictures, go to Site Administration->Security->Site Policies. If you scroll all the way down to the bottom, you'll see a checkbox to disable profile images.
Average of ratings: Useful (3)
In reply to Ann Adamcik

Re: Unable to stop users editing their profile

by Simon A -
Thanks, it works now, accept that now all users can see all courses.

I had my moodle setup to enable students to only see their courses, but now that I have assigned system roles to students, they can see all the courses.

In reply to Simon A

Re: Unable to stop users editing their profile

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 Simon,

If you only want students to be prevented from editing their profile, and not all users, you can create a new role, such as Restricted user as described in Demo teacher role, with moodle/user:editownprofile set to prevent, and assign it to all students in the system context.

Alternatively, you could change moodle/user:editownprofile to not set for the authenticated user role, then create a new role for teachers with moodle/user:editownprofile set to allow.
Average of ratings: Useful (3)
In reply to Helen Foster

Re: Unable to stop users editing their profile

by Simon A -
Thank you very much. It all works now.big grin
In reply to Helen Foster

Re: Unable to stop users editing their profile

by Erlyn Baack -

Before the ROLES changeover, there used to be the simplest little hack (a line or two) that we could paste into the config.php file.  It prevented changing pictures.

Does that simple hack (wherever it is, and I wish someone would supply it); does that simple hack not work any more?

Thanks!

Actually, I just found the hack in an old version, 1.5.4+.  It's this in the config.php file:

// Prevent users from updating their profile images
//      $CFG->disableuserimages = true;

Would that cause problems putting it in a 1.9.5+ file (about a month old)?

Thanks again!

In reply to Erlyn Baack

Re: Unable to stop users editing their profile

by Randy Orwin -
HI Erlyn,

See Ann Adamcik's post above. You can disable changing profile pictures by going to the site administration block then go to Security->Site policies and scroll down towards the bottom and find the "Disable User profile images option". Check the box and you should be good to go.
Average of ratings: Useful (1)
In reply to Randy Orwin

Re: Unable to stop users editing their profile

by Erlyn Baack -

Thanks!  I'm happy to know that works. 

The problem with other courses didn't affect my application because I have only one other course, and it's hidden.

A major advantage to this newer application 1.9.5 as opposed to the lines in the config.php file back in 1.5.4 is that teachers or administrators can still change photos while students can't.  Under the OLD system, teachers had to disable the line in the config.php file, make the changes, then go back to enable the line in config.php.  This is a LOT easier! wink  I'm happy to say that!

In reply to Helen Foster

Re: Unable to stop users editing their profile

by Sebastien Jaffredo -

Hi Helen

Thanks for the tip. I used the "Demo teacher role" method before, but I'm having problems with these students showing everywhere on the site because they have system roles.

Regarding the alternative way (change moodle/user:editownprofile to not set for the authenticated user role, then create a new role for teachers with moodle/user:editownprofile set to allow): that would require this new teacher role to be set as context=system and the teachers to be given this role at the system level, right ?

I'm struggling to find a way to allow some to and modify their profile prevent the rest from modifying their profile without giving any a system-wide role. Isn't that possible ?

In reply to Sebastien Jaffredo

Re: Unable to stop users editing their profile

by Sebastian Gendry -

Am somewhat perplexed as well, but most likely I missed something somewhere:

Edit own user (profilemoodle/user:editownprofile) is not allowed for students in Site Admin / Users / Permissions / Define roles, yet students can still edit their own name / email / password in /user/edit.php

In my particular case I integrate with a 3rd party application that takes care of the login, so I don't want students to change their login info inside of moodle.

How would I do that?

In reply to Sebastian Gendry

Re: Unable to stop users editing their profile

by Tim Hunt -
Picture of Core developers Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers