In my latest personal Umbraco project I had the need for a
persistent admin navigation when a Member was logged in, but on
this project I had two different Member types so needed to show a
different admin menu based on the Role the user was assigned
to.
Sounds simple enough to do with a LoginView and it is, but this
admin menu has a login status regardless of role and also some
other bits above and below the menus I won't go into that would be
visible regardless of role too (And I didn't want to appear on the
page if the user wasn't logged in).
So I came up with a little idea of nesting LoginViews, I didn't
know you could do this but it worked a treat for what I
needed. I have just added the below into my Master.master and
it works perfectly with the Umbraco membership (The code below is
trimmed down compared to the actual code in my project to show the
concept).
<asp:LoginView ID="lvAdminPanel" runat="server">
<LoggedInTemplate>
<div id="adminpanel">
<div id="adminpanelstatus">
<p>
<span class="status"><umbraco:Macro Alias="LoginStatus" runat="server"></umbraco:Macro></span>
Your Admin...
</p>
</div>
<div id="adminpanelmenu">
<asp:LoginView ID="lvAdminPanelMenu" runat="server">
<RoleGroups>
<asp:RoleGroup Roles="JobSeeker">
<ContentTemplate>
<umbraco:Macro ID="JobSeekerMacro" source="1174" Alias="SeekerNavigation" runat="server"></umbraco:Macro>
</ContentTemplate>
</asp:RoleGroup>
<asp:RoleGroup Roles="JobPoster">
<ContentTemplate>
<umbraco:Macro ID="JobPosterMacro" source="1179" Alias="PosterNavigation" runat="server"></umbraco:Macro>
</ContentTemplate>
</asp:RoleGroup>
</RoleGroups>
</asp:LoginView>
</div>
</div>
</LoggedInTemplate>
</asp:LoginView>
As you can see I just dump the status in the first LoginView and
then use the <RoleGroups> in the nested LoginView to display
a custom XSLT Navigation macro for each role. I know this isn't
ground breaking, but I found nesting the LoginViews worked really
well for me in a multi Member Type scenario :)