I’m trying to set up a typical feature in modern websites with the round icon that has the logged in members initials in it? Anyone know if this can be done?
Hi James, If you use the Wix Members login widget, this should exist out of the box (for members without a profile picture). If you are trying to build a custom icon, you could utilize the currentMember method in 'wix-members-frontend' to get a logged in members info. With that info you can then use Velo to get the first character from the first and last name and set the text value of a text element as the initials. It would look something like this:
import { currentMember } from "wix-members-frontend";
async function setInitials(){
const member = await currentMember.getMember();
const firstInitial = member.contactDetails.firstName.substring(0,1);
const lastInitial = member.contactDetails.lastName.substring(0,1);
$w("#initialsText").text = firstInitial + lastInitial;
}
GOLD! thank You
Hi James, If you use the Wix Members login widget, this should exist out of the box (for members without a profile picture). If you are trying to build a custom icon, you could utilize the currentMember method in 'wix-members-frontend' to get a logged in members info. With that info you can then use Velo to get the first character from the first and last name and set the text value of a text element as the initials. It would look something like this:
import { currentMember } from "wix-members-frontend"; async function setInitials(){ const member = await currentMember.getMember(); const firstInitial = member.contactDetails.firstName.substring(0,1); const lastInitial = member.contactDetails.lastName.substring(0,1); $w("#initialsText").text = firstInitial + lastInitial; }
Good luck!
Eitan