# Fetch and use site members' custom info fields

**URL:** <https://forum.wixstudio.com/t/fetch-and-use-site-members-custom-info-fields/73500>\
**Category:** Show and tell\
**Tags:** wix-crm-backend, wix-editor, wix-members-area, code\
**Created:** [September 11, 2025, 3:35am UTC](https://forum.wixstudio.com/t/fetch-and-use-site-members-custom-info-fields/73500 "2025-09-11T03:35:52Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Andre\_Moreira](https://sea1.discourse-cdn.com/wix/user_avatar/forum.wixstudio.com/andre_moreira/32/106081_2.png) [@Andre\_Moreira](https://forum.wixstudio.com/u/Andre_Moreira)\
**Post date:** [September 11, 2025, 3:35am UTC](https://forum.wixstudio.com/t/fetch-and-use-site-members-custom-info-fields/73500/1 "2025-09-11T03:35:52Z")

</div>

**Introduction:**  
In my website, I added a private parameter which users can set in their profile. This parameter affects the display of the website, so it is a variable that needs to be fetched from the backend to customize the way the website displays.

The problem is, I did not know how to fetch this value.

After a lot of searching and trying, I got to the solution I needed, so I thought I might as well share it with anyone that might need to do something similar. There might be easier solutions, but at least this worked for me, so it’s worth giving it a try if you are facing a similar problem.

**How I did it:**  
The code is as follows. I’m skipping error checks and logs so it becomes shorter and straight to the point.

```javascript
import { Permissions, webMethod } from 'wix-web-module';
import { currentUser } from 'wix-users-backend';
import { contacts } from 'wix-crm-backend';

export const getUserGamesPerPage = webMethod(Permissions.Anyone, async () => {
    try {
        const user = currentUser;
        
        // Get the current user email, so we can compare with the contacts
        const userEmail = await user.getEmail();
        
        // Query contacts by email to get the contact ID
        const queryResults = await contacts.queryContacts()
            .eq("primaryInfo.email", userEmail)
            .find({ suppressAuth: true });
        
        const contactsResult = { items: queryResults.items };
        
        // Use the contact data directly from the query results
        const contact = contactsResult.items[0];
        
        // Extract the custom field value for "Games per page" from extendedFields
        const gamesPerPage = contact.info?.extendedFields?.["custom.games-per-page"];
        
        if (gamesPerPage !== undefined && gamesPerPage !== null) {
            const value = parseInt(gamesPerPage);
            return value;
        }

    return 0;
        
    } catch (error) {
        console.error("Error in getUserGamesPerPage:", error);
        return 0;
    }
});

```

**Tools, Documentation and APIs:**  
Here are some of the pages I checked:

[https://dev.wix.com/docs/api-reference/crm/members-contacts/members/custom-fields/custom-fields/list-custom-fields](https://dev.wix.com/docs/api-reference/crm/members-contacts/members/custom-fields/custom-fields/list-custom-fields)

> **[Query Contacts | Velo](https://dev.wix.com/docs/velo/apis/wix-crm-backend/contacts/query-contacts)**
>
> Creates a query to retrieve a list of contacts. The queryContacts() function builds a query to retrieve a list of contacts

---

<div class="post-metadata">

**Author:** ![noahlovell](https://sea1.discourse-cdn.com/wix/user_avatar/forum.wixstudio.com/noahlovell/32/118920_2.png) [@noahlovell](https://forum.wixstudio.com/u/noahlovell)\
**Post date:** [September 11, 2025, 11:43am UTC](https://forum.wixstudio.com/t/fetch-and-use-site-members-custom-info-fields/73500/2 "2025-09-11T11:43:55Z")

</div>

Love this! Thanks for sharing! 🙏

As a sidenote, `wix-users-backend` is deprecated, so I’d recommend using `wix-members-backend`.

It’s a pretty straightforward change.

Instead of:

```javascript
import { currentUser } from 'wix-users-backend';
const userEmail = await user.getEmail();

```

You’d:

```javascript
import { currentMember } from "wix-members-backend";

const member = await currentMember.getMember(options);
const userEmail = member.loginEmail
```

---

<div class="post-metadata">

**Author:** ![Andre\_Moreira](https://sea1.discourse-cdn.com/wix/user_avatar/forum.wixstudio.com/andre_moreira/32/106081_2.png) [@Andre\_Moreira](https://forum.wixstudio.com/u/Andre_Moreira)\
**Post date:** [September 11, 2025, 1:36pm UTC](https://forum.wixstudio.com/t/fetch-and-use-site-members-custom-info-fields/73500/3 "2025-09-11T13:36:18Z")

</div>

Ah! Of course! Forgot about that one.  
Thanks for the tip!! 🙂

---

<div class="post-metadata">

**Author:** ![kaylag](https://sea1.discourse-cdn.com/wix/user_avatar/forum.wixstudio.com/kaylag/32/31519_2.png) [@kaylag](https://forum.wixstudio.com/u/kaylag)\
**Post date:** [December 18, 2025, 2:13pm UTC](https://forum.wixstudio.com/t/fetch-and-use-site-members-custom-info-fields/73500/4 "2025-12-18T14:13:00Z")

</div>

This line is doing absolutely nothing suspicious
