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

HomeHomeDevelopment and...Development and...Getting StartedGetting StartedCanCan't update custom profile field from my module
Previous
 
Next
New Post
10/21/2011 2:53 PM
 
I'm relatively new to DNN module development.  I'm working on a module that requires that I be able to update the value of a custom field that I have added to the user profile thru the DNN Admin screen.  I have no problem updating the value thru Admin --> User Accounts --> Manage Profile screen.  I also have no problem reading the value of the field from my module using the following code:

CType(UserInfo.Profile.GetPropertyValue("CustomField"), Integer)

However, when I try to modify this field using the following code it doesn't update the field.  I don't get an error but the field does not get updated.

This is placed at the top of the code behind page with the other import statements:
Imports DotNetNuke.Entities.Profile

This code is in a subroutine:
        Dim objUser As UserInfo = UserController.GetCurrentUserInfo()
        objUser.Profile.SetProfileProperty("CustomField", UserCustomField)
        UserController.UpdateUser(PortalId, objUser)

The only time that I would be updating this value is if there wasn't previously a value associated with it.  I don't know whether that is the problem and I have to create the field for the user prior to updating it or whether I'm doing something else wrong. If I need to create the field first then I could use some guidance as to how to do this.

Any help would be greatly appreciated.
 
New Post
10/21/2011 3:35 PM
 
Try this:

objUser.Profile.SetProfileProperty(objUser.Profile.ProfileProperties.GetById(CustomField).PropertyName, UserCustomField.ToString());


Steven Webster
Manager, Community Platform
F5 Networks, DevCentral
 
New Post
10/21/2011 5:48 PM
 
I tried using the code you suggested but in the process I found a logic error in my code.  Once fixed the code that I had in place worked the way it was.  I really appreciate your taking the time to help. Trying the code that you suggested and checking out how far in the process I had gotten so that I could answer your suggestion is what led me to discover the error of my ways.  Thanks again.
 
Previous
 
Next
HomeHomeDevelopment and...Development and...Getting StartedGetting StartedCanCan't update custom profile field from my module


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