Forum Discussion

micha80's avatar
micha80
Expert
10 years ago

How to get profile album using REST API?

Hello,

 

I want to rewrite the "view-profile-banner" component cause we want to make a custom avatar image when a new avatar image is uploaded but not aproved. Normaly, in messages an unproved image is replaced by a "Aproval-Image" and we want the same behaviour for the avatar image. After contacting the support they told me this is not working out of the box.

 

Then I did some research and I found the following solution:

 

1. Grab all unaproved images with the LiQL (SELECT * FROM images WHERE owner.id = 'XXX' AND visibility = 'unapproved')

2. Itereate them and grap the album id.

3. Read all properties from the actual album with LiQL (SELECT * FROM albums WHERE id = 'XXX')

 

This is working fine but now I have to verify wether the actual album is the profile album or not. I can not use the title as an identifier cause a moderator can rename the album title in the admin area. Any other hints on check wether this is the profile album or not? Or any better hint on integrating the requirement?

 

Regards,

Michael

  • OlivierS's avatar
    OlivierS
    Lithium Alumni (Retired)

    micha80 

     

    A quick workaround would be to use JavaScript (should be easy withjQuery)

    1- you check if the avatar is the "Aproval-Image" (might have a different class / id ; definitely a different name)

    2- you replace the image with the one you want

     

    Inconvenient: it's client side

     

     

     

    • micha80's avatar
      micha80
      Expert

      Hi Olivier,

       

      thanks for the reply. I could not use JS for this cause the system displays the old avatar image and this is the problem. So there is no chance to detect wether the new uploaded image is accepted or not. I thought that using RestAPI for this could solve my problem.

       

      Any other ideas?

       

      Regards,

      Michael