Filtering based off a getPhone

I am having a hard time with getting this code to work. I am trying to create a filter for a dataset which has field for phone number based off the logged in user’s phone number. Here is what I have so far:

import wixData from ‘wix-data’;
import wixSite from ‘wix-site-backend’;

export function getPhone() {
return wixSite.generalInfo.getPhone(phone);
}

$w.onReady(function () {
$w(“#StallSalesItem”).onReady(() => {
$w(“#StallSalesItem”).setFilter(wixData.filter().eq(“trainerCellPhone”, phone)
);
}
}
Any help would be greatly appreciated!

The getPhone() function gets the site’s phone number - that is, your phone number, not that of the user. As stated in the documentation:

The retrieved phone number is the phone number that has been entered in the General Info section of your site’s Dashboard.

You can query the PrivateMembersData Collection to get the user’s phone numbers.

After looking at that page it looks like you can’t do that on a dynamic page, is that incorrect? Can I do query to get current logged in member phone? The dynamic page will only be available to logged in members.