mosaddik.dev
All posts

How to show each Wix member only their own data with Velo

Mosaddik Billah 2 min read

Wix Velo

A login screen with username and password fields
Photo by Zulfugar Karimov on Unsplash
On this page
  1. 1. Set up the collection and permissions
  2. 2. Make the page members-only
  3. 3. Load the member’s items
  4. 4. Let members add items
  5. A no-code alternative
  6. When to go further

A members area is more useful when it shows each person their own things: their orders, bookings, documents or progress. In Wix you can do this with a CMS collection, the right permissions and a few lines of Velo.

This guide builds a “My requests” page where each logged-in member sees only the requests they created.

1. Set up the collection and permissions#

Create a collection called Requests with fields such as title, status and details. Every item Wix creates also gets a hidden _owner field: the ID of the member who added it.

Open the collection’s Permissions and set:

  • Read: Site member author (members can read only items they created)
  • Create: Site member
  • Update: Site member author
  • Delete: Admin

These permissions are the real protection. Page code runs in the visitor’s browser and can be changed, so never rely on a filter in page code alone to hide other people’s data.

2. Make the page members-only#

Create a page called My requests, open its settings, and under Permissions choose Members only. Visitors who aren’t logged in are asked to log in before they see it.

3. Load the member’s items#

Add a repeater #requestsRepeater with text elements #title and #status inside each item, and a text element #emptyText that says “You don’t have any requests yet.” Hide #emptyText on load. Then add this page code:

JavaScript
import wixData from "wix-data";
import { currentMember } from "wix-members-frontend";

$w.onReady(async () => {
  const member = await currentMember.getMember();
  if (!member) return;

  const result = await wixData
    .query("Requests")
    .eq("_owner", member._id)
    .descending("_createdDate")
    .find();

  if (result.items.length === 0) {
    $w("#requestsRepeater").collapse();
    $w("#emptyText").show();
    return;
  }

  $w("#requestsRepeater").onItemReady(($item, itemData) => {
    $item("#title").text = itemData.title;
    $item("#status").text = itemData.status;
  });
  $w("#requestsRepeater").data = result.items;
});

What’s happening:

  • currentMember.getMember() returns the logged-in member, or nothing if no one is logged in.
  • .eq("_owner", member._id) asks only for this member’s items. With the permissions from step 1, the database would refuse to return anyone else’s items anyway.
  • The empty state tells new members what the page is for instead of showing a blank space.

4. Let members add items#

To let members create requests, connect a form to the same collection through a dataset set to Write mode. Because the creator becomes the _owner, each new request shows up on their page automatically.

A no-code alternative#

For a simple list, you can skip the code: connect the repeater to a dataset, and in the dataset settings add a filter where Owner is the logged-in user. Use the Velo version when you need sorting, custom empty states, or data combined from more than one collection.

When to go further#

Member dashboards often grow to include status updates by email, file uploads per member, admin pages where your team updates statuses, or data pulled from another system.

If you’d like a members area built for your Wix site, I do Wix Velo development.

Comments