← blogs.sussex.ac.uk

Importing user profile photos into Moodle

At Sussex we encourage the use of user profile images (avatars) in our Moodle installation because it provides a more personal learning experience, encourages interaction and improves usability of the system by having more graphic representations of data.

However many students and staff haven’t uploaded an avatar in Moodle. We have therefore initiated a Spring term project to import staff or student card photos from users web profiles, where they have permitted its use.

Current use of card photos

In Sussex’s Managed Learning Environment (MLE), Sussex Direct, you can select to show your staff or student card photo to everyone on the web. Staff can also upload an alternative photo. These options are respected within the MLE, the staff profile pages visible on the Sussex web pages, but they are not currently respected in our Moodle installation.

Development plan

In Moodle, Sussex’s Virtual Learning Environment (VLE), users can put up avatars of themselves. These avatars can be more casual than a card photo. We like this because it reflects the informal learning environment that the VLE can represent. However, where a staff or student hasn’t selected to put up an avatar we would like to use the card  photo where they have permitted everyone to see it.

A new picture_sussex database table

We created a new table in the Moodle database so

  • We have a record of all photos copied
  • If a copied photo is deleted in Moodle we don’t copy it again

The logic will work as follows:

For each current Moodle user without an avatar already and who has allowed use of their Sussex card photo we will:

  • Copy card photos from their unrestricted web address
  • Store them in a temporary directory
  • Process them for Moodle
  • Move them into the Moodle user directory
  • Update the “picture” field in their Moodle user record
  • Store a record that photo has been passed in a new table called “picture_sussex”

To prevent photos being copied again if a user deletes their copied card photo from Moodle, we record this within the new “picture_sussex” table.

If a user updates their Moodle picture and a record exists of the picture in the “picture_sussex” table the record will be deleted unless the “deleted time” field is set.

Exclusions

Because of the informal nature of Study Direct, we don’t want users avatars from Moodle passed back to the more official MLE.

There will be no facility for keeping availability flag in sync if permission settings are updated on Study Direct or Sussex Direct. The user can however delete the picture from Study Direct manually.

2 Comments