Hey everyone, I'm on DNN 5.1 and I've been trying to get this to work for about 2 weeks now. It seems there aren't many tutorials online for this particular bit. I'm basically trying to be able to get and set user profile properties such as name, email, phone and a few custom properties that have been added.
This is essentially what I am doing that isn't working
DotNetNuke.Entities.Users.UserInfo CurUser = new DotNetNuke.Entities.Users.UserInfo();
CurUser.Profile.InitialiseProfile(this.PortalID);
CurUser.Username = this.UserName;
CurUser.UserID = this.UserID;
CurUser.Profile.SetProfileProperty("FirstName", this.FirstName);
CurUser.Profile.SetProfileProperty("CustomField", this.CustomField);
DotNetNuke.Entities.Users.UserController.UpdateUser(this.PortalID, CurUser);
DotNetNuke.Entities.Profile.ProfileController.UpdateUserProfile(CurUser);
I usually get an error saying something like "Object reference not set to an instance of an object", which I don't believe is true. I'm not sure if I'm being vague or leaving anything out, but if anyone could help me out that would be super.
Thanks,
Stefan