Craig100
10/03/2024, 9:43 AM<p>Welcome back <strong>@Context?.User?.Identity?.Name</strong></p>
which displays the user's email address. Is there a quick way of getting the member's actual Name or is it a matter of converting the partial to a ViewComponent and firing up the MemberService?
Thanks.Craig100
10/03/2024, 9:52 AMSebastiaan
10/03/2024, 10:19 AMcsharp
@using Umbraco.Cms.Core.Security
@inject IMemberManager MemberManager;
@{
var memberName = string.Empty;
var currentMember = await MemberManager.GetCurrentMemberAsync();
if (currentMember != null)
{
var member = MemberManager.AsPublishedMember(currentMember);
memberName = member?.Name;
}
}
<p>@memberName</p>
Sebastiaan
10/03/2024, 10:41 AMD_Inventor
10/03/2024, 12:16 PMIMemberManager.GetCurrentMemberAsync
also touched the database through dotnet identity. You should probably measure it to see if you get database bottlenecks.Sebastiaan
10/03/2024, 12:22 PMServices
will cause heavy database operations and you should only use them if you're going to need to do updates, not for querying.D_Inventor
10/03/2024, 12:24 PM