Hi! I was wondering if there is any way to edit a users info? (I.e. Email or Nickname) so in case someone wanted to change their login email or if someone has an inappropriate nickname that I could change? TIA!
Hello Clarity,
perhaps this may help you…
https://www.wix.com/corvid/reference/wix-users-backend/updateuserfields
Thanks, but how would I go about changing someones nickname/email with this? Do I type it as a page’s code, or? (Sorry, I don’t code) Much help would be appreciated
Hello again,
i would say you simply can’t change the nickname. All you can change is:
import wixUsersBackend from 'wix-users-backend';
2
3export function updateUserFields(userId, firstName, lastName, email, phone) {
4 wixUsersBackend.updateUserFields(userId, {
5 "firstName": firstName,
6 "lastName": lastName,
7 "emails": [email],
8 "phones": [phone]
9 } )
10 .then( () => {
11 // contact has been updated
12 } )
13 .catch( (err) => {
14 // there was an error updating the contact
15 } );
16}
Perhaps you can use the —> “SLUG” for your purposes.
import wixUsersBackend from 'wix-users-backend';
2
3export function getUser(id) {
4 return wixUsersBackend.getUser(id);
5}
6
7/* Returns a promise that resolves to:
8 *
9 * {
10 * "id": "dn8sf9c2-4e9f-a02d-a58d-f244d999729a",
11 * "memberName": "John Doe",
12 * "firstName": "John",
13 * "lastName": "Doe",
14 * "nickname": "johnd",
15 * "slug": "johnd123",
16 * "language": "en",
17 * "status": "ACTIVE",
18 * "loginEmail": "john.doe@somedomain.com",
19 * "creationDate": "2019-08-05T11:29:39Z",
20 * "lastUpdateDate": "2019-08-12T12:29:43.810Z",
21 * "lastLoginDate": "2019-08-12T13:42:30Z",
22 * "emails": [
23 * "john.doe@somedomain.com",
24 * "doughyjohn@anotherdomain.com"
25 * ],
26 * "phones": [
27 * "5555555555",
28 * "5555555556"
29 * ],
30 * "labels": [
31 * "contacts-new",
32 * "contacts-site_members_approved"
33 * ],
34 * "picture": {
35 * "url": "https://.../photo.jpg"
36 * }
37 * "customText": "Custom Text",
38 * "customNumber": 12345
39 * }
40 */
@russian-dima Okay thanks! But where would I put the code? And how would I change the values?
@claritylove67
Which VALUES do you wanna change?
All you can change is:
5 “firstName” : firstName ,
6 “lastName” : lastName ,
7 “emails” : [ email ],
8 “phones” : [ phone ]
The slug is generated automativally. You could use it eventually for your purposes.
You would have to put this code on two places.
- Back-End-Code into a JWS-FILE-SECTION.
- And Front-End-Code into the CODE-SECTION of the SITE.
You should perhaps first learn some stuff about back-end and front-end.
This is not an easy to do job.