Pagina del profilo utente per ID?

Esiste un percorso per accedere al profilo pubblico di un utente utilizzando il suo ID?

So dell’esistenza di: https://meta.discourse.org/u/{username}/summary
E io vorrei: https://meta.discourse.org/u/{user-id}/summary

Scopo: Voglio che i profili sul mio sito principale colleghino ai profili sul mio sito Discourse. Il problema è che inizialmente non stavo utilizzando l’SSO, quindi i nomi utente non sono tutti coerenti tra i due siti e vengono aggiornati quando l’utente si disconnette e riaccede. Ho tentato di “svuotare” i vecchi ID utente solo per rendermi conto che non esiste un endpoint per aggiornare i nomi utente (è possibile aggiornare solo email e avatar).

Poiché i nomi utente cambiano, ho salvato l’id invece, ma ora mi rendo conto che non posso generare direttamente un URL per accedere al loro profilo tramite ID. Dovrei effettuare ulteriori richieste web, cosa che sto cercando di evitare. Altrimenti, penso di dover colpire l’endpoint by-external una volta per ottenere il nome utente, ma una reindirizzamento sarebbe preferibile.

If you’re trying let users get their own profile, yo can use /my/summary/

https://meta.discourse.org/my/summary

2 Mi Piace

Thanks but no, I want any user viewing a profile on my main site, to be able to click a link on that page to take them to the corresponding profile on the discourse page.

1 Mi Piace

It would be great if there were a PUT endpoint for username. The use case is sites like mine which transitioned to SSO, to get all the usernames synced. Then my plan A would have just worked.

My fallback plan I think is going to be to add another column to store discourse_username also in my DB along with discourse_id. This way, I can directly to their profile with username. The downside is that this username can change. So I need to daily scan all users to re-sync.

You can make a POST request to /admin/users/sync_sso for this. If you are using the Discourse API gem, you can use the gem’s sync_sso method for this. If you are not using the gem, see Sync DiscourseConnect user data with the sync_sso route for details about setting up the request.

4 Mi Piace

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.