Geeks With Blogs

News My Blog has been MOVED to https://mfreidge.wordpress.com
Michael Freidgeim's OLD Blog My Blog has been MOVED to https://mfreidge.wordpress.com

Provided by core Register form (\admin\Security\Register.ascx.vb) shows many fields, including address details and Adminsitrator can make them optional, but not hide them.  
I was requested to show only minimal (Firstname/surname/username/email/passwords) and hide others from register screen, but leave them visible when open in user profile.

The change in \admin\Security\Register.ascx.vb BindData() function is in the end of new user registration section

If Services = 1 Then
.............

Else
.....
              If Request.IsAuthenticated Then
.......

Else 'new user registration
.......

                    'MNF 30/3/2006 added
                    'No UI to set it at the moment
                    Dim htSitSettings As Hashtable = Entities.Portals.PortalSettings.GetSiteSettings(PortalSettings.PortalId)
                    Dim bMinimalRegistrationFields As Boolean = FSHelperLib.DataHelper.Nz(htSitSettings("MinimalRegistrationFields"), False)
                    If (bMinimalRegistrationFields = True) Then
                        Me.addressUser.Visible = False
                        Me.userControl.WebSiteVisible = False
                        Me.userControl.IMVisible = False
                    End If
                    'MNF 30/3/2006 added end
              End If
End If

I also had to make public properties userControl.WebSiteVisible and userControl.IMVisible in DNNLibrary\Controls\User.vb

        'MNF 30/3/2006 added to hide not important fields
'*
'* Property WebSiteVisible (boolean)
'*
Public Property WebSiteVisible() As boolean
    Get
                Return txtWebsite.Visible
    End Get
    Set(Byval Value As boolean)
                txtWebsite.Visible = Value
                plWebsite.Visible = Value
    End Set
        End Property
        '*
        '* Property IMVisible (boolean)
        '*
        Public Property IMVisible() As boolean
            Get
                Return txtIM.Visible
            End Get
            Set(Byval Value As boolean)
                txtIM.Visible = Value
                plIM.Visible = Value
            End Set
        End Property
        'MNF 30/3/2006 added end

Because I didn't create user interface to setup the MinimalRegistrationFields flag, the following SQL can be used to insert row/change the value.

declare @SiteSettingsModuleId int

select @SiteSettingsModuleId=dbo.dnn_Modules.ModuleID

FROM dnn_Modules INNER JOIN

dnn_ModuleDefinitions ON dnn_Modules.ModuleDefID = dnn_ModuleDefinitions.ModuleDefID INNER JOIN

dnn_DesktopModules ON dnn_ModuleDefinitions.DesktopModuleID = dnn_DesktopModules.DesktopModuleID

WHERE (dnn_DesktopModules.FriendlyName = N'Site Settings')

if NOT exists (select * from dbo.dnn_ModuleSettings WHERE (dnn_ModuleSettings.SettingName = N'MinimalRegistrationFields') AND dnn_ModuleSettings.ModuleID =@SiteSettingsModuleId )

INSERT INTO dnn_ModuleSettings (ModuleID,SettingName,SettingValue)

values(@SiteSettingsModuleId,N'MinimalRegistrationFields','true')

else

update dnn_ModuleSettings

set SettingValue='true'

FROM dnn_ModuleSettings

WHERE (dnn_ModuleSettings.SettingName = N'MinimalRegistrationFields') AND dnn_ModuleSettings.ModuleID =@SiteSettingsModuleId

Posted on Friday, March 31, 2006 6:34 AM | Back to top


Comments on this post: DotNetNuke Register form with minimal fields.

No comments posted yet.
Your comment:
 (will show your gravatar)


Copyright © Michael Freidgeim | Powered by: GeeksWithBlogs.net