Uploading user profile picture via CSV user importing
-
Hi y'all,
I'm currently developing an extension to the user .csv importing plugin.
It already allows group memberships during creation.
Now, I'm trying to upload the profile picture as well.
My first approach was to host all images in an external service (Airtable, S3, etc), and put the link in the .csv used to importing users.
This didn't work because the uploadCroppedPictureFile expects a locally accessible path, not a URL.
Can you think of an alternative solution that would allow the picture to be imported via .csv?
I'm still learning the codebase I would love some hints.
-
Since you already have the picture url on a different system you can just set the
user.picture
field to it and it should work I think.
Instead of callingawait User.uploadCroppedPictureFile(uploadData)
tryawait User.setUserField(user.uid, 'picture', user.profile_picture_url)
-
Hi @Eduardo-Silva — what hook does
updateProfilePicture
listen for, the one sent by the import-users-csv plugin?If you already have a URL, it's probably easiest to just call
user.updateProfile
with thepicture
property.Keep in mind for the
updateProfile
call, you have to pass in['picture']
to the third argument. -