Hi! I’ve made a website where there is a default avatar in the header that appears on every page. With help of some here, I created a code in Wix Dev that successfully replaces the header with the member’s custom profile picture once they are logged in. (See attached picture and code below)
Here is my issue:
The code I have must have something in it that makes the site log-in page pop up automatically on each new page, until the visitor signs up. This is very annoying for the user.
How can I fix this code so the log-in page doesn’t pop up automatically? I want the default header avatar to be replaced with the user’s choice…but I don’t want the log-in page to pop up, until they actually choose for themselves to click the button at the bottom of the page to “sign up”!
~SEE CURRENT CODE BELOW~
import { authentication, currentMember } from “wix-members-frontend”;
import { authentication, currentMember } from “wix-members-frontend”;
$w.onReady(function () {
**const** isLoggedIn = authentication.loggedIn();
**if** (isLoggedIn) {
fetchMemberData();
} **else** {
authentication
.promptLogin({ mode: 'login', modal: \*\*false\*\* })
.then(() => {
fetchMemberData();
})
.\*\*catch\*\*((error) => {
console.error(error);
});
}
});
function fetchMemberData() {
currentMember
.getMember({ fieldsets: \\\['FULL'\\\] })
.then((member) => {
$w('#image857').src = member.profile.profilePhoto.url;
})
.\*\*catch\*\*((error) => {
console.error(error);
});
