How can I Filter a dataset by URL?

How can I filter a dataset by a part from the URL? Let me explain what I want to do.

There is already a page called “forum posts”. This page shows us “our own” posts. What I want to do is when I go to someone’s profile page, seeing his/her posts on their profile page. Think of it like any social media profile page, like Twitter profile pages.

I created a “Posts” dataset and a repeater to do this. If I don’t apply any filters, all posts on the forum are listed. I want to filter this according to the owner of the profile page I am currently looking at. The name of the profile page I’m looking at is in the URL after all. like this :

https://....../profile/gamemakerturkiye/profile

Can’t I get member name from the URL and compare it with the owner of the posts and filter them? Or any different way?

It depends on your collection schema, but basically let’s say you have a postURL field, then you can do something like:

let toFilterBy = "gamemakerturkiye";
$w("#dataset").filter(wixData.filter().contains("postURL", toFilterBy));

[FIXED]

Thanks so much, but I couldn’t. Maybe I can do with using iframe as a simpler way. I can embed Wix’s default Forum Posts page inside the Profile page. For example, if I write this, I see “my” posts on my profile page:

<iframe src="https://_____/home/profile/gamemakerturkiye/forum-posts" width="100%" height="500" frameborder="0" scrolling="auto" allowtransparency="true"></iframe> 

but this code will always show “my” forum posts. I want to see the posts of whose profile I’m on right now. I guess I need to get the information from the current profile page URL :

https://__________/home/profile/gamemakerturkiye/profile
       |     0    | 1  |   2   |       3        |   4

I need to get the “3rd” part of the URL, which I marked. Can I get and automatically write or send it into the iframe?

For example,

        //If I'm looking at John's profile page
https://______/home/profile/john/profile

        //the iframe should look like this:
<iframe src="https://_____/home/profile/john/forum-posts" width="100%" height="500" frameborder="0" scrolling="auto" allowtransparency="true"></iframe> 

I want to do this automatically, but I don’t know how can I do.

I guess, first I need to get the 3rd part from the URL somehow in the page code. Then I have to send it as a message to the HTML Element. And then I need to auto write this information to that part of the iframe URL.

This page helped me think like that, but I don’t know if this logic is correct.

https://support .wix .com/en/article/corvid-working-with-the-html-iframe-element#messaging-1

If this logic is correct, I don’t fully understand how to do it. or is there a more logical way to do what I want?

I’m sorry if I’m asking too much, I’m also trying to research and understand as much as I can. Thanks so much again :slight_smile:

HI, did you find a solution?