Is it possible to have an automatically updating link to a user's profile picture? Such as by giving each user one "slot" for an avatar?

We’re trying to set up a “Site Staff” page with info for our admins and moderators, and ideally it would have all of their profile pictures as well. For example:

codinghorror


Bio: I exist
Contact Info: stuff

However, we don’t want to have to manually update this page any time a staff member changes their profile picture.

There are two ways we can see to go about doing this - whenever a user uploads a new profile picture, directly replace the old one and keep the link the same (which would be preferable we think), or some kind of link that redirects to wherever the user’s current avatar is located.

Any thoughts on the best way to accomplish this? Just copying the link from their current picture does not work as intended from our testing.

As noted above, it would help storage space if we could just force each user to upload any new profile picture to the same location, which would automatically allow the same link to work as intended and also save storage space.

That’s basically the about page isn’t it? Like About - Discourse Meta

The correct way of keeping user info synchronized between different system is using DiscourseConnect - Official Single-Sign-On for Discourse (sso). However that may be too much if all you want is a static page with the current forum admins. In that case you can maybe have a daily/weekly script that parses /about.json and updates it?

3 Likes

Yeah, we’re more than happy with having users register on the actual site, so SSO seems a bit overkill. As for the about page, the issue with that is there’s no place for a bio or outside contact info, which really kills its ability to be a one-stop shop. We also imagine it might be harder to add all of this to the about page than to get an updating image working on another page.

A script isn’t a bad idea, although an instant response time would obviously be better if possible - it’s helpful for a user to be able to visually connect the profile picture with the status, and it could be disorienting to new users if the picture on the page and in use don’t match.

Plus, the fact that the old profile picture is still saved rather than overwritten by a new one seems disadvantageous for storage reasons anyways. If we could simply give each user one link that their profile picture is stored in, and replace that image if they change it, that seems like it really kills two birds with one stone.

There is a site setting to add an external contact method to the about page.

Didn’t mean for the about page to be parsed on your page rendering process, but in a background task and only periodically.

This depends on what tech you use to build said page. For example if you are on the JAMstack, this makes sense on the compilation phase. If it’s a Rails app, maybe an Active Job that runs daily and updates your local cache in the database.

We call those orphaned uploads, and they are cleaned up after a few days automatically via a background task.

2 Likes

Would it make more sense to simply replace the orphaned upload with a new upload?

Seems to me to be a win-win but I’m not a web developer so it’s possible I’m overlooking something.