The reference figure and the steps below explain the process of setting the avatars for the users in ONLYOFFICE Docs.
To set the current user avatar, use the editorConfig.user.image field of the initialization config:
new DocsAPI.DocEditor("placeholder", { "editorConfig": { "user": { "group": "Group1", "id": "78e1e841", "image": "https://example.com/url-to-user-avatar.png", "name": "John Smith" } }, });
In the configuration script for Document Editor initialization, specify the event handler for setting the users' avatars. When the user opens the comments or a list of the co-editors, the onRequestUsers event is called with the data.id parameter. The data.c parameter with the info operation type is also passed in this event.
var onRequestUsers = function (event) { var c = event.data.c; var id = event.data.id; ... }; var docEditor = new DocsAPI.DocEditor("placeholder", { "events": { "onRequestUsers": onRequestUsers, ... }, ... });
In order to set the users' avatars, the setUsers method must be called:
docEditor.setUsers({ "c": "info", "users": [ { "email": "john@example.com", "id": "78e1e841", "image": "https://example.com/url-to-user-avatar1.png", "name": "John Smith" }, { "email": "kate@example.com", "id": "F89d8069ba2b", "image": "https://example.com/url-to-user-avatar2.png", "name": "Kate Cage" }, ... ] });
Where the example.com is the name of the server where document manager and document storage service are installed. See the How it works section to find out more on ONLYOFFICE Docs service client-server interactions.