How to add a Log In / Log Out / Dashboard link to a header in new theme

Topics: General, Writing themes
Sep 17, 2013 at 1:26 PM
I have created a new child theme of the So. Bootstrap theme. However, I am not able to find how to add Log In / Log Out / Dashboard link at the header.

I have reviewed default theme - theme machine and checked its view files but nothing is clear!

Can someone explain how to do this?

I'm new to this and just learning, so your help is highly appreciated.

Thanks in advance.
Sep 17, 2013 at 2:08 PM
Edited Sep 17, 2013 at 2:09 PM
I´ve never used that theme, but i can point you to a place that helped me a lot, it´s a 4 part series of blog posts that explains how to create a bootstrap based theme in orchard (in the second post the author mentions how to do, what you want):

http://www.philipsenechal.com/blog/creating-an-orchard-theme-from-a-wrapbootstrap-template-part-1#.UjhiN8aHt8E
Sep 19, 2013 at 1:48 PM
Hi,

Thanks for your response.

I finally got some idea, but now have another question!
WorkContext.Layout.Header.Add(New.User(), "1"); // Site name and link to the home page
Adding above line to the layout file adds a Login/Logout/and Dashboard link in the header. But at the wrong place. We want to add it to the different place, before header in the top-bar we're having.

Now, this line
WorkContext.Layout.UserNavigation.Add(New.User(), "1"); // Login and dashboard links
Which should add this to the User Navigation area doesn't add it. Actually this doesn't work at all.

So what is the logic behind this. And more importantly how to use this to place it at my specified place in the html markup?

Any help is appreciated.

Thanks in advance.
Developer
Sep 19, 2013 at 3:18 PM
Edited Sep 19, 2013 at 3:22 PM
Are you sure that the UserNavigation zone is actually being displayed? Ie. @Display(Layout.UserNavigation) should be somewhere in your layout.

Add something to a zone (Layout.XXX.Add(...)) and then display the zone where you want with @Display(Layout.XXX) - this is the correct way of pushing stuff to various places in your markup.
Sep 20, 2013 at 7:02 AM
Thanks for your reply.
It's working now.