# Update data in WixMembers by code

**URL:** <https://forum.wixstudio.com/t/update-data-in-wixmembers-by-code/64710>\
**Category:** Ask the community\
**Tags:** wix-members-area, code, question, wix\
**Created:** [November 15, 2024, 8:32am UTC](https://forum.wixstudio.com/t/update-data-in-wixmembers-by-code/64710 "2024-11-15T08:32:03Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![user3373](https://sea1.discourse-cdn.com/wix/user_avatar/forum.wixstudio.com/user3373/32/97855_2.png) [@user3373](https://forum.wixstudio.com/u/user3373)\
**Post date:** [November 15, 2024, 8:32am UTC](https://forum.wixstudio.com/t/update-data-in-wixmembers-by-code/64710/1 "2024-11-15T08:32:03Z")

</div>

**Question:**  
Hello everbody,

I created my own account page, linked to WixMembers.  
I would like members to be able to modify their personal data (picture, telephone number, email, address, etc.).

It’s OK for finding the member, and extract “RecupNomClt” & “RecupMailClt”, but I have an error when requesting Update (In the example below, I would like to modify the profile photo.

**Error msg in the console :** “Uncaught (in promise) R: WDE0004: Failed to save [[object Object]] into [Members/PrivateMembersData].  
Items must be JavaScript objects.”

Thanks for your help

**Product:**  
Wix Editor

My Code below :

> $w(‘#MAJProfil’).onClick((event) =\> {
> 
> // RECHERCHER LE CLIENT  
> return wixData.query(‘Members/PrivateMembersData’)  
> .eq(“\_id”, $w(‘#UserID’).value)  
> .find()  
> .then(async (results) =\> {  
> //1°/ MODIFIER LA PHOTO DU CLIENT  
> console.log("Effectuer la recherche à partir de l’ID: "+ “(” + $w(‘#UserID’).value + “)”)
> 
> ```
> const RecupNomClt = results.items.map(item => item.name)
> const RecupMailClt= results.items.map(item => item.loginEmail)
> 
> console.log("Nom : " + RecupNomClt)
> console.log("Mail : " + RecupMailClt)
>   
> const MAJPictClt = results.items.map(item => ({ ...item, picture: $w('#Photoprofil').src}))
>    
> await wixData.update('Members/PrivateMembersData', MAJPictClt);
>   
> console.log(results); >  
> 
> ```
> 
> });
> 
> })

---

<div class="post-metadata">

**Author:** ![onemoretime](https://sea1.discourse-cdn.com/wix/user_avatar/forum.wixstudio.com/onemoretime/32/104023_2.png) [@onemoretime](https://forum.wixstudio.com/u/onemoretime)\
**Post date:** [November 15, 2024, 2:56pm UTC](https://forum.wixstudio.com/t/update-data-in-wixmembers-by-code/64710/2 "2024-11-15T14:56:56Z")

</div>

Hi, user3373 !!

First, I believe there might be an issue with the permissions required to modify data in the Private Members Data collection. Since the data in this collection is protected based on the permissions settings, you would need to temporarily relax the permissions in the backend to execute the `update()` method. (I’m not entirely sure if it’s actually possible to edit this collection’s data—apologies, but please verify this yourself…)

As for the error you’re encountering, it’s likely because the `update()` method only accepts a single object as its argument, but you’re passing an array. Since `map()` returns an array, `MAJPictClt` becomes an array, which is the root cause of the issue. 🙌

---

<div class="post-metadata">

**Author:** ![Alexandre\_B](https://sea1.discourse-cdn.com/wix/user_avatar/forum.wixstudio.com/alexandre_b/32/94185_2.png) [@Alexandre\_B](https://forum.wixstudio.com/u/Alexandre_B)\
**Post date:** [November 15, 2024, 5:37pm UTC](https://forum.wixstudio.com/t/update-data-in-wixmembers-by-code/64710/3 "2024-11-15T17:37:23Z")

</div>

Hi  
For me you have to use updateMember( )  
[https://dev.wix.com/docs/velo/api-reference/wix-members-backend/members/update-member](https://dev.wix.com/docs/velo/api-reference/wix-members-backend/members/update-member)

and other function depending of what you want update.

Best regards,

---

<div class="post-metadata">

**Author:** ![onemoretime](https://sea1.discourse-cdn.com/wix/user_avatar/forum.wixstudio.com/onemoretime/32/104023_2.png) [@onemoretime](https://forum.wixstudio.com/u/onemoretime)\
**Post date:** [November 16, 2024, 12:47am UTC](https://forum.wixstudio.com/t/update-data-in-wixmembers-by-code/64710/4 "2024-11-16T00:47:54Z")

</div>

That’s probably the right answer! 🙌

---

<div class="post-metadata">

**Author:** ![user3373](https://sea1.discourse-cdn.com/wix/user_avatar/forum.wixstudio.com/user3373/32/97855_2.png) [@user3373](https://forum.wixstudio.com/u/user3373)\
**Post date:** [November 16, 2024, 1:43pm UTC](https://forum.wixstudio.com/t/update-data-in-wixmembers-by-code/64710/5 "2024-11-16T13:43:01Z")

</div>

Hi

thanks for your answers. I’ll try with “Update Member” and tell you .

---

<div class="post-metadata">

**Author:** ![user3373](https://sea1.discourse-cdn.com/wix/user_avatar/forum.wixstudio.com/user3373/32/97855_2.png) [@user3373](https://forum.wixstudio.com/u/user3373)\
**Post date:** [November 19, 2024, 11:01am UTC](https://forum.wixstudio.com/t/update-data-in-wixmembers-by-code/64710/6 "2024-11-19T11:01:41Z")

</div>

Hello

I didin’t succeed. But not very important for the moment, my site works fine. il will see later for this (modify the picture of a logged member)

thanks
