As we continue to look at potential integration paths between Dot Net Nuke and Community Server, I thought it would be nice to get the two running under the same IIS website... Actually to do this is rather quite simple... All you HAVE to do, is:
Now that should get you a working CS install under DNN, the only real "magic" involved was the DNN siteurls.config. This allows you to have a CS site running along side you DNN installation... Also if you have installed CS into your DNN directory you are a step closer to having integrated logins.
To integrate the logins with a portal on your DNN installation, you need to have created your CS install under your DNN application, and then you need do a couple more steps. (I highly recommend you do these, they extend the steps before 6 above and replace 7 and 8)
That should do it, you can register multiple DNN portals in CS, the only rule is that they have to have a unique "SiteURL"; so under this scheme, only portals with unique URLS can be tied to CS installs, DNN "Sub Portals" are not part of the CS URL and therefore do not qualify.
This leaves us with a couple of loose ends; new users created in DNN will not be automatically created in the CS tables (the following SQL snippit will fix this)
Declare @ApplicationName nvarchar(512)
Declare @SettingsID int
Declare @ApplicationID uniqueidentifier
Set @ApplicationName = 'YourPortalID'
Select @ApplicationID = ApplicationId FROM aspnet_Applications where LoweredApplicationName = Lower(@ApplicationName)
Select @SettingsID = SettingsID FROM cs_SiteSettings where ApplicationName = @ApplicationName
--Import ApplicationID specific users from aspnet_Users if they dont already exists
INSERT INTO [cs_Users]([MembershipID], [ForceLogin], [UserAccountStatus], [AppUserToken], [LastActivity], [LastAction])
SELECT aspnet.UserID, 0,1, null, getdate(), '' from dbo.vw_aspnet_MembershipUsers aspnet LEFT OUTER JOIN dbo.cs_vw_Users_FullUser cs on aspnet.UserID = CS.UserID WHERE aspnet.ApplicationID = @ApplicationID and cs.UserID is null
--Create cs_UserProfile records for any cs_Users without Profiles
INSERT INTO [cs_UserProfile]([UserID], [TimeZone], [TotalPosts], [PostSortOrder], [PostRank], [IsAvatarApproved], [ModerationLevel], [EnableThreadTracking], [EnableDisplayUnreadThreadsOnly], [EnableAvatar], [EnableDisplayInMemberList], [EnablePrivateMessages], [EnableOnlineStatus], [EnableHtmlEmail], [MembershipID], [SettingsID], [PropertyNames], [PropertyValues])
SELECT cs_Users.UserID, 0, 0, 0, 0x01, 0, 0, 0, 0, 0, 0, 0, 1, 0, cs_Users.MembershipID, @SettingsID, NULL, NULL FROM cs_Users LEFT OUTER JOIN cs_UserProfile on cs_Users.UserID = cs_UserProfile.UserID Where cs_UserProfile.UserID is null
And finally all of your user admin must be done through DNN, actually the CS user admin screen will be broken as a result of us removing the timezone key... I am working on a fix for this one at the moment... If you have the CS 1.1 source code here is a fix that will work, Edit the CommunityServerComponents\Componets\Profile.cs:
/// <summary>
/// Specifies the user's timezone offset.
/// </summary>
public double Timezone {
get
{
object obj = GetObject("timezone");
if (profilebase["timezone"].GetType() == Timezone.GetType())
return obj == null ? 0 : ( double )obj;
else //DNN stores this as an INT (Minutes off GMT)
returnobj == null? 0 : Convert.ToDouble(obj)/60;
}
set
{
if(profilebase["timezone"].GetType() == Timezone.GetType())
{
if ( value < -12 || value > 12)
Set("timezone",0);
else
Set("timezone",value );
}
else //DNN stores this as an INT (Minutes off GMT)
{
Set("TimeZone",Convert.ToInt32( value *60));
}
}
}
#endregion
Happy Hacking =)
Dan http://blog.danbartels.com/articles/753.aspx?CommentPosted=true#commentmessage