dynamically switch themes in Orchard

Topics: Administration, Announcements, Customizing Orchard, General, Writing modules, Writing themes
Aug 15, 2013 at 1:50 PM
Edited Aug 15, 2013 at 2:03 PM
I had made two themes for my site.One is for front end and second is back end. The front end totally different from back-end. My senior is that when normal user is view my site then front theme is rendered and when Administrator is logged in then back end theme is rendered. I have tested my themes that both works fine.But I don't know how to dynamically switch themes on current user status ?
I made Services folder in my module made class to make Admin theme for my that module but i don't know How to full fill my senior. Any help would be appreciated
public  class ThemeSelector : IThemeSelector
    {
   


     

          
        public ThemeSelectorResult GetTheme(RequestContext context)
        {
          
            
                return new ThemeSelectorResult { Priority = 90, ThemeName = "AdminTheme" };
            
            
        }
 



    }
`
Developer
Aug 16, 2013 at 5:54 AM
You have to implement IThemeSelector for that. Simply copy "AdminThemeSelector" from Orchard.Framework/UI/Admin to your own module, and change the theme name to yours and use a higher priority.
Aug 16, 2013 at 7:52 AM
Thank sfmskywalker I did little bit goggling and read some discussion on CodPlex then got the answer specially this Switching the layout in Orchard CMS article helped me alot and I got my solution