Products

Solutions

Resources

Partners

Community

Blog

About

QA

Ideas Test

New Community Website

Ordinarily, you'd be at the right spot, but we've recently launched a brand new community website... For the community, by the community.

Yay... Take Me to the Community!

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

HomeHomeArchived Discus...Archived Discus...Developing Under Previous Versions of .NETDeveloping Under Previous Versions of .NETASP.Net 2.0ASP.Net 2.0Vexing searches Vexing searches
Previous
 
Next
New Post
1/1/2007 6:34 PM
 

Okay I know I have seen this code somewhere - If I create a profile property called 'Company' and a user fills it in how do I access that property in code - both to grab it and/or change it as needed?

TIA


Dylan Barber http://www.braindice.com - Dotnetnuke development classes - skins and modules
 
New Post
1/2/2007 4:22 AM
 

if you have gotten a reference to the proper userInfo object using something like this:

Dim myUser as UserInfo = UserController.GetUser(PortalID, someUserID, True)

then you can get to individual property values like this:

dim myUsersCompanyName as string = myUser.Profile.GetPropertyValue("Company")

and you can set a new value like this:

myUser.Profile.SetPropertyValue("Company","ACME")

HTH


Erik van Ballegoij, Former DNN Corp. Employee and DNN Expert

DNN Blog | Twitter: @erikvb | LinkedIn: Erik van Ballegoij on LinkedIn

 
New Post
1/2/2007 2:21 PM
 

Erik - thats exactly what I needed

 

Thanks


Dylan Barber http://www.braindice.com - Dotnetnuke development classes - skins and modules
 
New Post
1/2/2007 2:23 PM
 

Erik - how do I adapt this to check if that property exists?

TIA


Dylan Barber http://www.braindice.com - Dotnetnuke development classes - skins and modules
 
New Post
1/3/2007 12:50 AM
 

ERIK - the code you gave me doesnt seem to do it -

This is so frustrating - reading over the membership doc doent really give more than a high level overview

(DNN 4.4.0)

How do I create a profile for a user i create like this

If Page.IsValid Then
                Dim myUserInfo As Users.UserInfo = New Users.UserInfo
                With myUserInfo
                    'Membership
                    .Membership.Username = Me.tbUserName.Text
                    .Membership.Email = Me.tbEmailAddress.Text
                    .Membership.Approved = True
                    .Membership.Password = Me.tbPassword.Text
                    'Profile
                    .Profile.FirstName = Me.tbFirstName.Text
                    .Profile.LastName = Me.tbLastName.Text
                    .Profile.Unit = Null.NullString
                    .Profile.Street = Null.NullString
                    .Profile.City = Null.NullString
                    .Profile.Region = Null.NullString
                    .Profile.PostalCode = Null.NullString
                    .Profile.Country = Null.NullString
                    .Profile.Telephone = Null.NullString
                    'DNN
                    .PortalID = PortalId
                    .Username = Me.tbUserName.Text
                    .FirstName = Me.tbFirstName.Text
                    .LastName = Me.tbLastName.Text
                    .Email = Me.tbEmailAddress.Text
                    .AffiliateID = Null.NullInteger
                    .DisplayName = Me.tbFirstName.Text.Trim & " " & Me.tbLastName.Text.Trim
                End With

                Dim CreateStatus As UserCreateStatus = Users.UserController.CreateUser(myUserInfo)
                myUserInfo.Profile.InitialiseProfile(PortalId)
                Dim something_other As New Entities.Profile.ProfilePropertyDefinitionCollection
                something_other = Entities.Profile.ProfileController.GetPropertyDefinitionsByPortal(PortalId)
                Dim num As Integer = 0
                For Each x As Entities.Profile.ProfilePropertyDefinition In something_other
                    Response.Write(x.PropertyName)
                    Response.Write("--")
                    Response.Write(x.PropertyValue)
                    Response.Write("<br />")
                Next

                Users.UserController.UpdateUser(PortalId, myUserInfo)

                'Here we check the user status of the user we created or tried to create
                'if there is a problem we pull up a message and keep the page up so they
                'can change it - possibility of marking the field wrong exists maybe
                
                'Response.Write(myUserInfo.UserID)
            End If

Nothing is ever created in the UserProfile table untill I go check and update the profile through the DNN interface - I cant figure out how the default register page does this


Dylan Barber http://www.braindice.com - Dotnetnuke development classes - skins and modules
 
Previous
 
Next
HomeHomeArchived Discus...Archived Discus...Developing Under Previous Versions of .NETDeveloping Under Previous Versions of .NETASP.Net 2.0ASP.Net 2.0Vexing searches Vexing searches


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.
What is Liquid Content?
Find Out
What is Liquid Content?
Find Out
What is Liquid Content?
Find Out