I have a site with content only for members with active status.
I use this code to check members status:
$w.onReady( () => {
wixData.query(“Members”)
.eq(“_id”, wixUsers.currentUser.id)
.eq(“_status”, “y”)
.eq(“membercategory”, “carrental”)
.count()
.then ( (mem) => {
if (mem===0) {
wixLocation.to(“/supplier”);
}
});
The problem is if I check the site with inactive status (or other membercategory) I can see the content (filtered repeater) for a few sec (until the code finish) and just after that jump the site to “/supplier”.
This way anybody can see the content without activation for a few sec and this is really enough for e.g. a printscreen.
Can anybody help?
Is there any solution to run this code before the content (filtered repeater) appears?
Thx!
Imre
Hi Imre,
You don’t describe how you’re displaying the “filtered repeater” so I can only guess…
Change this section of your code to include the repeater stuff:
if (mem===0) {
wixLocation.to("/supplier");
}
else {
$w("#repeater").data = filteredRepeaterData;
}
Then the repeater will only display if you know you have results for that user.
I hope this helps,
Yisrael
Thx Yisrael,
I filtered my repeater via Dataset (right click > filter).
So in this case it seems ‘filteredRepeaterData’ statement not working.
What should I use instead?
THx!
Imre
Imre,
Sorry, but I really don’t understand. When and How did you filter your dataset? What code? Do you know if you have results?
Please post the URL of your site. Only authorized Wix personnel can get access to your site in the editor.
Yisrael
Okey,
I simply filter my repeater manually without any code:
Here is the URL one of the example site:
If you click on it you can see the delay as well (as a not logged in, not registered and non active visitor).
Thx!
Imre
One way to solve your problem would be to hide the Repeater on load:

You could then do this if the user is authorized to view the information:
if (mem===0) {
wixLocation.to("/supplier");
}
else {
$w("#repeater").show();
}
Another option would be to use code to set the Repeater’s data as I suggested in my original example code. This way the Repeater is only displayed if the user is authorized.
I hope this helps,
Yisrael
Thx a lot, to hide the repeater is perfect for me now, it works well!
Imre