Auto-update owner's picture using a code

@russian-dima I’ve tried your code but then it didn’t work.
I tried the code below, but then again, it didn’t work… :thinking:
In your code, I noticed that you haven’t put a query in your Member-Data database.

Anyway, thanks for your help! Good job! :blush:

$w.onReady(function () {
    wixData.query("Messages")
    .eq("_owner", wixUsers.currentUser.id)
    .find()
    .then((results) => {
 let dataLength = results.items.length;
        console.log(dataLength)
 if(dataLength > 0) {
 let msg = results.items;
 let profilePic = msg.profilePicture;
 
            wixData.query("MemberPage")
            .eq('_id', wixUsers.currentUser.id)
            .find()
            .then((result)=>{
 
 for (var i = 0; i < dataLength; i++) {
                profilePic.push(result.items[i].profilePicture)
                }
 return [msg, profilePic]
            })
        } else {
 //
        }
        console.log("END")
    })
    .catch( (err) => {
 let errorMsg = err;
    });
})