How do you stop users (students) from editing their profiles?

How do you stop users (students) from editing their profiles?

by G D -
Number of replies: 22
How do you stop users from editing their own profiles? I am using moodle for a school distirct and surprise, the students misuse the heck out of being able to change their profiles, mostly the uploading of avatars. I have been through the admin settings multiple times and I would have thought the option to allow or disable profile editing would be in there somewhere, but i'll be darned if I can't find it. If someone could give me a step in the right dorection I would REALLY appreciate it. Thanks.
Average of ratings: -
In reply to G D

Re: How do you stop users (students) from editing their profiles?

by J B -
Log in as admin, go Site Administration > Users > Authentication and just choose the user fields you want to lock.

Considering that locking down avatars restricts the freedom of everyone owing to - in our case anyway - a tiny minority, I found it preferable to temporarily replace offending avatars on the server with a read-only image of Beaker, from the Muppet show.

Average of ratings: Useful (1)
In reply to J B

Re: How do you stop users (students) from editing their profiles?

by G D -
Thanks so much, I really appreciate the help. That worked fine. Good call on the read only images.
In reply to J B

Re: How do you stop users (students) from editing their profiles?

by Homer Morro -
James, we had a similar problem, but different enough we're hoping you can help:

We have managed to shut down the privileges to edit own profile for all users (except admin). Now, we want to allow teachers to edit their profiles. We're using the path:

Admin>Users>Permissions>Define Roles>Teachers>Edit Own Profile> Allow

We don't see, however, that privilege added to the teachers' profile.

Any suggestions?

Thanks in advance,
Homer
In reply to Homer Morro

Re: How do you stop users (students) from editing their profiles?

by John Isner -
To prevent a user from editing his own profile, you must prevent it in the System context. Overriding editownprofile in their User context won't have any effect because Moodle explicitly tests for this permission in System context:

has_capability('moodle/user:editownprofile',$systemcontext)

This may or may not be a bug, but it is scheduled to be revisited -- see MDL-14174.

Meanwhile, here are three methods. None of them is perfect. I'll give the pros and cons of each below.

(1) edit Authenticated user, setting moodle/user:editownprofile = Not set

or

(2) create a new role CannotEditOwnProfile with moodle/user:editownprofile = Prevent and assign it to users in the System context

or

(3) edit Authenticated user, setting moodle/user:editownprofile = Not set. Then create a new role CanEditOwnProfile with moodle/user:editownprofile = Allow and selectively assign CanEditOwnProfile to users in the System context

Comments:

(1) will prevent all users from editing their own profiles except for users with moodle/site:doanything = Allow (typically, only Administrator), so it will not work for you. This is probably what you have already done.

(2) requires the Administrator to manually assign CannotEditOwnProfile to users who SHOULD NOT be able to edit their profiles.

(3) requires the Administrator to manually assign CanEditOwnProfile to users who SHOULD be able to edit their profiles.

If only teachers should be able to edit their own profiles, then assuming there are fewer teachers than students, (3) is the most efficient solution.

Don't waste your time overriding the Teacher and Student roles. These roles are not assigned in the System context (at least they shouldn't be), so they will have no effect on users' ability to edit their own profiles.

Average of ratings: Useful (1)
In reply to John Isner

Re: How do you stop users (students) from editing their profiles?

by Kristen Walker -
I am trying to turn on the capability for users to edit their profiles. This was previously disabled by someone who worked on the site before me, and I am not sure how he did it.

Anyway, trying to turn the capability on via the permissions for the Authenticated User role is not having any effect. I even verified in the database that the setting is getting changed in the mdl_role_capabilities table. But, when I login in as a regular user, I still don't see the "edit profile" tab when I click on my name.

Does anyone have any idea where Moodle might be getting the idea that users don't have permission to edit their profiles. I am really stumped. Any info is much appreciated.

Thanks!
Kristen
In reply to Kristen Walker

Re: How do you stop users (students) from editing their profiles?

by John Isner -
Most likely you have set Site administration -> Users -> Permissions -> User policies -> Default role for all users = Guest. Set it back to Authorized user and users will be able to edit their own profiles. Let us know if this was the problem.
In reply to John Isner

Re: How do you stop users (students) from editing their profiles?

by Kristen Walker -
Hi John,
You are a miracle worker! That was it! As soon as I set the Default Role for All Users to Authenticated User, the Edit Profile tab appeared.

Thank you so much!

-Kristen

PS
Can you post a picture of your car after you paint it orange? Love the license plate!
In reply to Kristen Walker

Re: How do you stop users (students) from editing their profiles?

by John Isner -
Great, I'm glad that worked.

For ease in debugging future role-related problems, install the Role debugger. You can get it from the Modules and Plugins database (click here) and you can read an article about it here. Installation is easy -- just drop the script in your Moodle root directory. You can also post to the forum or e-mail me directly if you need help using the script or interpreting the results. It really demystifies roles and permissions.

The car below belongs to Jeffery Watkins. Can you believe it?

moodleorange.jpg
In reply to John Isner

Re: How do you stop users (students) from editing their profiles?

by Jeffery Watkins -
The car is really green. The orange is a Photoshop trick. I do have the plate though.

Jeff
In reply to J B

Re: How do you stop users (students) from editing their profiles?

by Lynda LaRoche -
Making a field locked does not work for our Moodle (1.8.4+), LDAP server authentication. Does anyone have any other ideas on how we can make specific user fields non-editable (for example: first name, last name, ID number)?
In reply to Lynda LaRoche

Re: How do you stop users (students) from editing their profiles?

by David O'Brien -
Hi Lynda
Did you manage to resolve this issue?

I was looking at a similar problem then I realized that I was testing against a user that had been created manually as opposed to Ldap account creation. Doh!

Just a thought!

Regards
In reply to G D

Re: How do you stop users (students) from editing their profiles?

by Jez H -
I changed Moodle source to allow only staff to upload avatars.

The change required the addition of a new permission and the alteration of profile forms.

Now, students only have the option to display the default Moodle avatar (our equivalent of the smiley) or an "official" image taken during student enrollment for their ID cards.

I have given details of the mod to a couple of other Moodlers, if anyone else is interested in seeing how this was done they can PM me their mail address...

Jeremy

In reply to Jez H

Re: How do you stop users (students) from editing their profiles?

by Teresa Gibbison -
Hi there Jeremy

Could you post the details of your mod changes to this forum for us? Either in the post or as an attachment file or patch?

Many thanks
Teresa
In reply to Teresa Gibbison

Re: How do you stop users (students) from editing their profiles?

by Jez H -
Hello Teresa,

Within a week or two I will be re-doing these changes for release 1.9.1. When I have done that I will post a zip of the altered / commented files here.

If in the mean time you would like to see the instructions / documentation I already have please PM me your mail address.... the doc contains (some very basic) info about our server which I do not want to publish here...

Regards, Jeremy


In reply to Jez H

Re: How do you stop users (students) from editing their profiles?

by Teresa Gibbison -
Thanks Jeremy, I can wait for you to release the info here as there is no major concern for us at present, I would just like to know how to do it if it becomes an issue!! We have some lecturers who are not happy that students can alter their image but others who agree it is their choice!! smile
Cheers
Teresa
In reply to Teresa Gibbison

Re: How do you stop users (students) from editing their profiles?

by Jez H -
We allowed students to select their own avatars for several years and its nice to allow this, but characters from the muppet show became too popular big grin
In reply to Jez H

Re: How do you stop users (students) from editing their profiles?

by Annick F -

Hi Jeremy,

This is exactly what we are looking for.Would you be kind enought to email the deatails on how to acheive this.Many Thanks

Annick

In reply to G D

Re: How do you stop users (students) from editing their profiles?

by Amy Skezas -

Hi, I am having the opposite issue. I want users to be able to edit their profiles, and they are being blocked.  I have set the default user level on the systemwide permissions to Authenticated User, and "edit own user profile" is checked as allowed, yet, people can't do it.  Any suggestions?  Many thanks.

Amy Skezas

In reply to Amy Skezas

Re: How do you stop users (students) from editing their profiles?

by Jason Hammes -

Hi Amy,

Did you figure this out?  I am experiencing the same issue.  My students do nto see an edit profile option even though I have the edit own user profile set to allow.

In reply to G D

Re: How do you stop users (students) from editing their profiles?

by Khalil Amar -

I went to 
Admin > Users > Permissions > Define Roles > Authenticated user
and set changeownpassword to Prohibit

Scroll down and Save