Learn More





Welcome to the DNN Community Forums, your preferred source of online community support for all things related to DNN.
In order to participate you must be a registered DNNizen

HomeHomeUsing DNN Platf...Using DNN Platf...Skins, Themes, ...Skins, Themes, ...DNN changing skin coloursDNN changing skin colours
New Post
5/16/2014 7:20 PM


Is there any way to change theme colors (blue, red etc ) in DNN skin using C# code . I do not want users in my DNN site to change the theme colors.I need to preset the colors for each user.

New Post
5/19/2014 4:22 AM
there is no mechanism built into DNN but you could add a color property to DNN user profile properties (in Site Settings > Manage User Profile) and retrieve it using Text skinobject with tokenReplace or inline code retrieving the property in the skin (e.g. by including a different css file).

Cheers from Germany,
Sebastian Leupold (Microsoft MVP)

dnnWerk - The DotNetNuke Experts   German Spoken DotNetNuke User Group   European Network of DotNetNuke Professionals

Speed up your DNN Websites with TurboDNN
New Post
5/19/2014 11:41 PM

Thanks for the reply.I am just wondering whether color changing can be done by loading different css files based on user ids.

For an example, user 1 - themes/Red.css,user 2 - themes/Blue.css etc..

I just do not know where to change the code.

I have seen how to load skins based on roles in following tutorial.

Dynamically Change DotNetNuke Skins by Security Role

Code snippet are as follows.

UserInfo oUser = UserController.GetCurrentUserInfo();
if (this.UserInfo != null && this.UserInfo.UserID > Null.NullInteger)
    if (this.UserInfo.IsInRole("My Security Role"))
        // import/using System.Web.HttpCookie 
        Response.Cookies.Add(new HttpCookie("SkinSrc", "[G]Skins/DarkKnight/Home-Mega-Menu.ascx"));
        // either assign another skin, or do nothing 
    // either assign another skin, or do nothing 


New Post
5/20/2014 3:35 AM
I think managing colors per user sounds like a huge admin overhead. If you really must do it then I would mark up the skin to generate a class based on the user id. Here is a snippet I use in a skin to mark up the tabid and the tabname. You could use a similar idea to grab the UserId. Attach this to the outermost div in the skin.

class='TabID<%=PortalSettings.ActiveTab.TabID%> TabName&lt;%=PortalSettings.ActiveTab.TabName.Replace(" ", "")%> TwoColRight'

Now you may write standard CSS rules to override colors etc based on the generated class names.

I still think it's hard to manage.

Best wishes,
- Richard
Agile Development Consultant, Practitioner, and Trainer
New Post
5/20/2014 4:50 AM
I created our free stylehelper skin object for these kind of tweaks.
It does not inject a userid stylesheet though.

I have some example skins on codeplex with a lot of DNN atrributes inline as a demo:
It also shows you how to add code to your skin.

I think what you are looking for is this: UserController.GetCurrentUserInfo().UserID
(from the simple skin example)
HomeHomeUsing DNN Platf...Using DNN Platf...Skins, Themes, ...Skins, Themes, ...DNN changing skin coloursDNN changing skin colours

These Forums are dedicated to discussion of DNN Platform and Evoq Solutions.

For the benefit of the community and to protect the integrity of the ecosystem, please observe the following posting guidelines:

  1. No Advertising. This includes promotion of commercial and non-commercial products or services which are not directly related to DNN.
  2. No vendor trolling / poaching. If someone posts about a vendor issue, allow the vendor or other customers to respond. Any post that looks like trolling / poaching will be removed.
  3. Discussion or promotion of DNN Platform product releases under a different brand name are strictly prohibited.
  4. No Flaming or Trolling.
  5. No Profanity, Racism, or Prejudice.
  6. Site Moderators have the final word on approving / removing a thread or post or comment.
  7. English language posting only, please.
Try Evoq
For Free
Start Free Trial
a Demo
See Evoq Live
Need More Information?