Members Username as File Prefix?

Last post 03-20-2006, 4:36 AM by Adam. 1 replies.
Sort Posts: Previous Next
  •  03-20-2006, 2:02 AM 17364

    Members Username as File Prefix?

    Is it possible to not only have Members images go into the "Members" folder but to also have the usernames added as prefixes to uploaded files so that only that user can see there files?
  •  03-20-2006, 4:36 AM 17365 in reply to 17364

    Re: Members Username as File Prefix?

    Yes, it's possible.
     
    If you are using the DNN, you need to change the following code of CEHtmlEditorProvider.vb:
     
               
                  If _UseDNNRoleASFileNamePrefix Then
                        Dim trim(1) As Char
                        trim(0) = "/"c
                        Dim tempfolder As String = ""
                        Dim Templatefolder As String = ""
                        tempfolder = RootImageDirectory
                        Templatefolder = RootImageDirectory.TrimEnd(trim) & "/templates"
                        cntlCE.SetSecurityImageGalleryPath(tempfolder)
                        cntlCE.SetSecurityFilesGalleryPath(tempfolder)
                        cntlCE.SetSecurityMediaGalleryPath(tempfolder)
                        cntlCE.SetSecurityFlashGalleryPath(tempfolder)
                        cntlCE.SetSecurityTemplateGalleryPath(Templatefolder)
                        Dim tempsecurity As String = ""
                        If role = "Admin" Then
                            tempsecurity = ""
                        ElseIf role = "Registered" Then
                            cntlCE.SetSecurityFileNamePrefix("Member_")
                        ElseIf role <> String.Empty Then
                            cntlCE.SetSecurityFileNamePrefix(role & "_")
                        End If
                    Else
                        Dim trim(1) As Char
                        trim(0) = "/"c
                        Dim tempfolder As String = "Guest"
                        Dim Templatefolder As String = ""
                        If role = "Admin" Then
                            tempfolder = ""
                        ElseIf role = "Registered" Then
                            tempfolder = "Member"
                        ElseIf role <> String.Empty Then
                            tempfolder = role
                        End If
                        tempfolder = RootImageDirectory.TrimEnd(trim) & "/" & tempfolder
                        Templatefolder = RootImageDirectory.TrimEnd(trim) & "/templates"
                        Dim phyfolder As String
                        phyfolder = HttpContext.Current.Server.MapPath(tempfolder)
                        If role = "Administrators" Then
                            phyfolder = HttpContext.Current.Server.MapPath(RootImageDirectory.TrimEnd(trim) & "/Admin")
                        End If
                        If Not Directory.Exists(phyfolder) Then
                            Directory.CreateDirectory(phyfolder)
                        End If
                        If Not Directory.Exists(HttpContext.Current.Server.MapPath(Templatefolder)) Then
                            Directory.CreateDirectory(HttpContext.Current.Server.MapPath(Templatefolder))
                        End If
                        cntlCE.SetSecurityImageGalleryPath(tempfolder)
                        cntlCE.SetSecurityFilesGalleryPath(tempfolder)
                        cntlCE.SetSecurityMediaGalleryPath(tempfolder)
                        cntlCE.SetSecurityFlashGalleryPath(tempfolder)
                        cntlCE.SetSecurityTemplateGalleryPath(Templatefolder)
                    End If
     
    to:
     
     
               
               
                  If _UseDNNRoleASFileNamePrefix Then
                        Dim trim(1) As Char
                        trim(0) = "/"c
                        Dim tempfolder As String = ""
                        Dim Templatefolder As String = ""
                        tempfolder = RootImageDirectory
                        Templatefolder = RootImageDirectory.TrimEnd(trim) & "/templates"
                        cntlCE.SetSecurityImageGalleryPath(tempfolder)
                        cntlCE.SetSecurityFilesGalleryPath(tempfolder)
                        cntlCE.SetSecurityMediaGalleryPath(tempfolder)
                        cntlCE.SetSecurityFlashGalleryPath(tempfolder)
                        cntlCE.SetSecurityTemplateGalleryPath(Templatefolder)
                        Dim tempsecurity As String = ""
                        If role = "Admin" Then
                            tempsecurity = ""
                        ElseIf role = "Registered" Then
                            cntlCE.SetSecurityFileNamePrefix("Member_")
                        ElseIf role <> String.Empty Then
                            cntlCE.SetSecurityFileNamePrefix(role & "_")
                        End If
                    Else
                        Dim trim(1) As Char
                        trim(0) = "/"c
                        Dim tempfolder As String = "Guest"
                        Dim Templatefolder As String = ""
                        If role = "Admin" Then
                            tempfolder = ""
                        ElseIf role = "Registered" Then
                            tempfolder = "Member"
                        ElseIf role <> String.Empty Then
                            tempfolder = role
                        End If
                        tempfolder = RootImageDirectory.TrimEnd(trim) & "/" & tempfolder
                        Templatefolder = RootImageDirectory.TrimEnd(trim) & "/templates"
                        Dim phyfolder As String
                        phyfolder = HttpContext.Current.Server.MapPath(tempfolder)
                        If role = "Administrators" Then
                            phyfolder = HttpContext.Current.Server.MapPath(RootImageDirectory.TrimEnd(trim) & "/Admin")
                        End If
                        If Not Directory.Exists(phyfolder) Then
                            Directory.CreateDirectory(phyfolder)
                        End If
                        If Not Directory.Exists(HttpContext.Current.Server.MapPath(Templatefolder)) Then
                            Directory.CreateDirectory(HttpContext.Current.Server.MapPath(Templatefolder))
                        End If
                        cntlCE.SetSecurityImageGalleryPath(tempfolder)
                        cntlCE.SetSecurityFilesGalleryPath(tempfolder)
                        cntlCE.SetSecurityMediaGalleryPath(tempfolder)
                        cntlCE.SetSecurityFlashGalleryPath(tempfolder)
                        cntlCE.SetSecurityTemplateGalleryPath(Templatefolder)
                    End If
     

    Then recompile your DNN provider.
     
    Hope it helps.
     
    Let me know if you have any further questions.
     
     

    asp.net Chat http://cutesoft.net/ASP.NET+Chat/default.aspx
    Web Messenger: http://cutesoft.net/Web-Messenger/default.aspx
    asp.net wysiwyg editor: http://cutesoft.net/ASP.NET+WYSIWYG+Editor/default.aspx
    asp wysiwyg html editor: http://cutesoft.net/ASP
    asp.net Image Gallery: http://cutesoft.net/ASP.NET+Image+Gallery/default.aspx
    Live Support: http://cutesoft.net/live-support/default.aspx

View as RSS news feed in XML