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...Building ExtensionsBuilding ExtensionsModulesModulesProfileProperties not saved anywayProfileProperties not saved anyway
Previous
 
Next
New Post
10/10/2016 6:53 AM
 

Hello everyone

I have developed a profile module where i can change some profile properties, as well as email, name etc.

I have 2 ajax functions, the first one calls a web service to save that profile values, the second one (calls another web service) is only called if first ajax response was successful to get that user profile properties and redraw them on the website.

I have been debugging and i'm sure it goes step by step over this (the web service to save values):

 public HttpResponseMessage PostSaveDisplayNameEmail(user usuario)

        {

            UserInfo me = new UserInfo();

            me = UserController.GetUserById(PortalSettings.PortalId, UserInfo.UserID);

            try

            {

                string returnName = PostCheckNombre(usuario);

                string returnEmail = PostCheckemail(usuario);

                if (returnEmail == "OK" || returnEmail == "isYourEmail")

                {

                    me.DisplayName = usuario.displayname;

                    me.Email = usuario.email;

                    me.FirstName = usuario.nombreUsuario;

                    me.LastName = usuario.apellidoUsuario;

                    me.Profile.SetProfileProperty("Facebook", usuario.ProfilePropertyFB);

                    me.Profile.SetProfileProperty("Twitter", usuario.ProfilePropertyTW);

                    me.Profile.SetProfileProperty("Google", usuario.ProfilePropertyGO);

                    ProfileController.UpdateUserProfile(me,me.Profile.ProfileProperties);

                    int portalId = me.PortalID;

                    UserController.UpdateUser(portalId, me);

                }

                return Request.CreateResponse(HttpStatusCode.OK, "dataSaved");

            }

[catch block etc...]

Now, if i pause debugging at last line, i can see "me" userinfo object contains the correct values for each parameter inside me.Profile.ProfileProperties.

But when this finishes and jquery calls second web service after 1st ajax.complete(), this code is returning old userinfo.Profile.ProfileProperties that are not the same ones saved at first web service.

This is the code:

 public HttpResponseMessage GetUserInfo()

        {

            UserInfo myDnnUser = new UserInfo();

            myDnnUser = UserController.GetUserById(PortalSettings.PortalId, UserInfo.UserID);

            try

            {

                user U1 = new user

                {

                    email = myDnnUser.Email,

                    displayname = myDnnUser.DisplayName,

                    fechaCreacion = myDnnUser.Membership.CreatedDate.ToString(),

                    fechaUltimaActividad = myDnnUser.Membership.LastActivityDate.ToString(),

                    nombreUsuario = myDnnUser.Profile.FirstName,

                    apellidoUsuario = myDnnUser.Profile.LastName,

                    ProfilePropertyFB = myDnnUser.Profile.GetPropertyValue("Facebook"),

                    ProfilePropertyGO = myDnnUser.Profile.GetPropertyValue("Google"),

                    ProfilePropertyTW = myDnnUser.Profile.GetPropertyValue("Twitter"),

                    RegularExpressionFB = DotNetNuke.Entities.Profile.ProfileController.GetPropertyDefinitionByName(PortalSettings.PortalId, "Facebook").ValidationExpression.ToString(),

                    RegularExpressionTW = DotNetNuke.Entities.Profile.ProfileController.GetPropertyDefinitionByName(PortalSettings.PortalId, "Twitter").ValidationExpression.ToString(),

                    RegularExpressionGO = DotNetNuke.Entities.Profile.ProfileController.GetPropertyDefinitionByName(PortalSettings.PortalId, "Google").ValidationExpression.ToString()

                };

                return Request.CreateResponse(HttpStatusCode.OK, U1);

[catch block etc...]

If i pause debugging when try block starts, i can see myDnnUser userinfo contains the initial profileproperties, so it doesn't save profileproperties at first web service. However, the rest of parameters as profile.firstname,userinfo.Email etc are correctly saved.

Please help me.

 
New Post
10/10/2016 7:43 AM
 
if you are on DNN Platform 8.0.4, please check out https://dnntracker.atlassian.net/brow... and use DLL attached to the issue.

Cheers from Germany,
Sebastian Leupold

dnnWerk - The DotNetNuke Experts   German Spoken DotNetNuke User Group

Speed up your DNN Websites with TurboDNN
 
New Post
10/10/2016 9:22 AM
 
Sebastian Leupold wrote:
if you are on DNN Platform 8.0.4, please check out https://dnntracker.atlassian.net/brow... and use DLL attached to the issue.

 

Ok that's working perfectly, thank you very much Leupold.
 
New Post
10/10/2016 11:24 AM
 
Carlos,
you are welcome.
Have fun developing on DNN :)

Cheers from Germany,
Sebastian Leupold

dnnWerk - The DotNetNuke Experts   German Spoken DotNetNuke User Group

Speed up your DNN Websites with TurboDNN
 
New Post
7/5/2017 8:10 PM
 
I am not sure if this was the crux of the fix you referenced Sebastian, but what I found was the key used to cache user profiles (using UserProfileCacheKey as template) was using the UserID value to create the key in GetUserProfile, but in RemoveCache it is using the Username to build the key. Just search for UserProfileCacheKey and you will see whta I'm talking about. Once I changed them all to use the same thing (Username) it started working fine.
 
Previous
 
Next
HomeHomeDevelopment and...Development and...Building ExtensionsBuilding ExtensionsModulesModulesProfileProperties not saved anywayProfileProperties not saved anyway


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