Slip Slip - 1 year ago 123
C# Question

Dnn 8: update user profile

I'm trying to update some user profile data from my custom module.

var userId = UserInfo.UserID;
var userInfo = UserController.GetUserById(UserInfo.PortalID, userId);

userInfo.Profile.SetProfileProperty("Country", "Russia");
userInfo.Profile.SetProfileProperty("Region", "Moskovskaya oblast");
userInfo.Profile.SetProfileProperty("City", "Moscow");

DotNetNuke.Entities.Profile.ProfileController.UpdateUserProfile(userInfo);

UserController.UpdateUser(UserInfo.PortalID, userInfo);


The first time the app starts it works. In the
UserProfile
module an updated value is displayed. (In debug
UpdateUserProfile
method runs consideraly long) But further updates have no effect on the displaued values. If I try to resave it in some minutes after it works again. I suppose there is some caching. How to disable it?

SOLUTION

..is here: http://www.dnnsoftware.com/forums/threadid/533148/scope/posts/threadpage/2
It's a bug in Dnn 8. I had to clear the cache using
DataCache.ClearCache();

Answer Source

Have you tried:

Entities.Profile.ProfileController.ClearProfileDefinitionCache(Me.PortalId)

or try this:

DataCache.ClearCache();
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download