Forum Discussion

wearesocialit's avatar
8 years ago
Solved

Changing custom avatar

Hi,

Is there a way to change a custom avatar set that I've used, so that every user has the corresponding new image?

 

From what I've seen in this thread https://community.lithium.com/t5/Developer-Discussion/How-to-replace-default-set-of-avatars/m-p/277884 this can be done only by professional services but I want to double check.

 

Thanks in advance

cheers

  • wearesocialit's avatar
    wearesocialit
    8 years ago

    TariqGrazitti wrote:

    @wearesocialit-

     

    Here is an API call to update the user avatar, you will need to create a script which will loop through all the users and will update avatar for each.

    Also, you need to create a mapping logic which will return you new avatar corresponds to old one.

     

    Thanks

    Tariq Hussain


    It turned out that it was a lot simpler than what we were thinking: it is possible to simply delete the old version of the avatar and upload a file with the exact same name.

7 Replies

  • wearesocialit's avatar
    wearesocialit
    Ace
    8 years ago

    Yes, but i don't want a single backup for errors I need replace each avatar with its corresponding updated...

  • TariqHussain's avatar
    TariqHussain
    Boss
    8 years ago

    wearesocialit-

     

    Here is an API call to update the user avatar, you will need to create a script which will loop through all the users and will update avatar for each.

    Also, you need to create a mapping logic which will return you new avatar corresponds to old one.

     

    Thanks

    Tariq Hussain

     

     

     

  • wearesocialit's avatar
    wearesocialit
    Ace
    8 years ago

    Hi TariqHussain,

     

    thanks for the answer, but from where in studio can I run scripts on lithium?

     

    Should I put the script in a custom component or do that "on demand" when a page needs it?

  • TariqHussain's avatar
    TariqHussain
    Boss
    8 years ago

    wearesocialit-

     

    I couldn't find any API V1 to update the user avatar and for API V2, you need to use http.client which only works inside endpoints and page initialization scripts. So, an endpoint is the best place to run this script.

     

    Here is the documentation for http.client request https://freemarker-docs-portal.lithium.com/refer/contextObjects#httpClient

    This is a one-time process, once you upload new avatars for users.

  • wearesocialit's avatar
    wearesocialit
    Ace
    8 years ago

    TariqGrazitti wrote:

    @wearesocialit-

     

    Here is an API call to update the user avatar, you will need to create a script which will loop through all the users and will update avatar for each.

    Also, you need to create a mapping logic which will return you new avatar corresponds to old one.

     

    Thanks

    Tariq Hussain


    It turned out that it was a lot simpler than what we were thinking: it is possible to simply delete the old version of the avatar and upload a file with the exact same name.

  • CarolineS's avatar
    CarolineS
    Boss
    8 years ago

    Oh, d'oh! I wish I'd thought of that! We just had a professional services engagement to mass-replace our avatars!