When is a publicdata entry made in members database?

I have coded a function that queries Members/PublicData to find its owners slug before changing linking text to that persons profile using that slug (rather then ID for a neat url).

wixData.query("Members/PublicData").eq("_id", wixUsers.currentUser.id).find().then(res=>{
        var txthtml = $w('#txtName').html;
        $w('#txtName').html = "<a href='https://www.mysite/profile/"+res.items[0].slug+"/profile'         target'_blank'>"+txthtml+"</a>";
});

I noticed just now that this doesnt work for all of my members, so i looked into it and found out that not everyone has a PublicData entry.

My questions are:
When is a PublicData entry made?
Are there any restrictions to accounts that stop them from having PublicData?
Is there a way for a PublicData entry for a member to be manually made?

Thanks.

Perhaps you will find your answer here…

My question was more to do with why some of my site’s members don’t have PublicData entries and if I could generate them manually.
Code wise, it’s no problem, I just substituted the slug with userId for the same result.

@devadrianhankin
My intention was to ask/show you → why using public data, if you also can get all private data instead?

However, when does the slug gets generated? During the registration-process? I think it will be so.

So taking a look onto my own example PMD (public)…


…hmmmmmm… everything seems to be correct → no empty fields inside “SLUG” DB-field.

So, perhaps something works wrong on your registration-process, idk.

BTW: you will find the example-DB shown above here…

https://russian-dima.wixsite.com/login-system