I am going to develop membership based portal in dotnetnuke.
In the same I want to allow portal manager to define skins for users.
Tell me how can I do that?
I am going to develop membership based portal in dotnetnuke.
In the same I want to allow portal manager to define skins for users.
Tell me how can I do that?
To change the skin dynamically based upon the user's role, see this explanation, from DotnetNuke.com:
There are a few different ways to dynamically or programmatically change the skin for a specific page load. DotNetNuke will look first for an override value in the URL. If specific value is found, then DNN will load that skin and/or container on that page load. Second, DNN will look in a local cookie to see if there is a skin being defined. Finally, if the first two methods did not specify a skin to load, DNN will load the default skins defined by the page or site. In the event that the skin doesn’t exist, the default skin that ships with DNN will be loaded.
This is why it’s important to not delete the original skin package after installing.
Probably the best way to approach dynamically loading a skin based on security role would be to create a simple cookie using either a DotNetNuke module, or HttpModule. Either way, you will be able to retrieve the user information, and based on the IsInSecurityRole() property, generate a cookie that will in effect load the desired skin.
In Essence, in a DotNetNuke Module placed on every page, you will have to check the following:
If the answer to #3 is "a non-default skin", then you will need to execute some code like this, taken from DotNetNuke.com:
'import DotNetNuke.Entities.Users'
If Not Me.UserInfo Is Nothing AndAlso Me.UserInfo.UserID > Null.NullInteger Then
If Me.UserInfo.IsInRole("My Security Role") Then
' import System.Web.HttpCookie
Response.Cookies.Add(New HttpCookie("SkinSrc", "[G]Skins/DarkKnight/Home-Mega-Menu.ascx"))
Else
' either assign another skin, or do nothing
End If
Else
' either assign another skin, or do nothing
End If
The above code snipped shows how to set the skin by adding a cookie key-value-pair.
I'd probably put the above logic into a DNN module that is invisible and is automatically added to all pages on the site; otherwise, you can probably inject the logic into Default.aspx (not recommended due to editing DNN core).
Note: PortalID is a field that is accessible in each module project. Response.Write("My Portal ID: " & PortalID.ToString())