Wix Member Area: filter a Dataset by the Owners ID

Hi

I have set up my members area using the wix memebers app and all it going great so far.

I have several pages that only the member can access so it’s easy to filter datasets on these pages as I can do it by .currentUser.

However, on the public pages (their profile and forum posts pages) I can’t seem to find a way to display/filter by the owners results from the dataset search.

I’ve tried getting the results from the address bar and removing the unwanted information ( to get the owners ID ) but the problem is that sometimes it returns the owners ID and sometimes it returns the username, e.g.:

https://domain.com/profile/{ID}/profile
https://domain.com/profile/{userName}/profile

let path = wixLocation.path;
var ret = path.replace(‘/profile’,‘’);

Any help would be greatly appreciated!

Many thanks

Thomas

HI, please review https://support.wix.com/en/article/how-to-filter-a-page-based-on-the-currently-logged-in-user .

Hi Olesiaz

Thanks for the reply.

My members area is organised via the Wix Members Area.

In each members area there is a public profile and a public forum posts section (view-able by anyone).

Members can submit to my database.

I want these posts to show in my members profile pages in the WIX Members Area.

If filtered by the currentUser.id it would show the posts of the current user, not the owner. If I filtered by isNot function, it would show everyone elses posts (not just the owner of the members page).

I need the member ID of the owner of the member area profile page to filter by.

Any ideas?

Kind regards

Thomas

Hi - ID field in Members collection is the same as Owner in all others collection. It is possible to use https://www.wix.com/code/reference/wix-users.User.html#getRoles

Hi Olesiaz

But this is again for the currentUser. What if they are visiting someone elses profile to view other members posts?

The Wix Member Pages aren’t dynamic in the sense i can filter my dataset using the owner of pages ID number.

Many thanks

Thomas

You’ve probably figured it out by now, but if not you can try this:

const user = wixUsers.currentUser; 
const email = await user.getEmail();  
const member = await wixData.query('Members/PrivateMembersData').eq("loginEmail", email).find(); 

Then use whichever field you want from the member.

Best,
Darryl

broken link - please remove

Hi Thomas,

did you solved your this problem, if yes please share the solution as I am facing same problem

Thanks
Said Thabet