Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Kris Janssen 210 posts 569 karma points c-trib
    Mar 27, 2014 @ 23:07
    Kris Janssen
    0

    Contour member profile edits not showing...

    Hi,

    I just implemented a member profile edit form according to this Nibble (Tim' s website) post.

    Together with that I installed CountourStrikesAgain (look for it on codeplex) to be able to actually update member fields upon form submission.

    This approach works, but only partly:

    When my form loads, the member information gets loaded using the notation {member.property}. Upon form submission, I can see in the Member section that indeed, the information gets updated. So far so good.

    HOWEVER... if I access the form again immediately after, the old information still gets loaded. Likewise, if I update member properties from the backend and save the member, also these changes are not reflected in the form, i.e. the defaultvalues do not get loaded properly through the curly bracket notation...

    Only a restart of Umbraco fixes this...

    Any ideas?

     

    Cheers,

    Kris

  • Kris Janssen 210 posts 569 karma points c-trib
    Mar 27, 2014 @ 23:15
    Kris Janssen
    0

    I suspect this is a caching issue:

    Others are seeing this as well 

    However, I' m not immediately sure what is the best way to invalidate the cache in this case...

  • Kris Janssen 210 posts 569 karma points c-trib
    Mar 28, 2014 @ 01:48
    Kris Janssen
    0

    I still have not found how I can make my edits immediately visible without restarting Umbraco.

    Another issue I noticed: upon upgrading to Contour 3.0.20, updating member properties using ContourStrikesAgain completely stops working. Edits even completely stop showing, even in the backend member section...

  • Comment author was deleted

    Mar 28, 2014 @ 09:33

    Yeah must be a member cache issue, it's probably the member tools that don't update the cache correctly

  • Kris Janssen 210 posts 569 karma points c-trib
    Mar 28, 2014 @ 10:08
    Kris Janssen
    0

    I' d have to browse the Umbraco Source but I suspect there is a method to flush the cache? If anybody knows, feel free to share? I suspect I could call it as a temporary fix...

  • Kris Janssen 210 posts 569 karma points c-trib
    Mar 30, 2014 @ 21:15
    Kris Janssen
    0

    An update to this:

    I upgraded my Umbraco install to 6.2.0 beta because it apparently features a new Membership Provider. At the same time, I also upgraded to Contour 3.0.20.

    This broke Contour Strikes Again (which is roughly identical to Member Tools. At this stage, the Workflow responsible for updating member properties failed to map fields correctly.

    For those interested, following alterations to the source code fixed that first issue:

    ...
    string mapping = "";
    
    if (!string.IsNullOrEmpty(a[2]))
        //mapping = record.RecordFields[new Guid(a[2])].ValuesAsString();
        mapping = record.RecordFields.Where(f => f.Value.Field.Id == new Guid(a[2])).First().Value.ValuesAsString();
    ...
    

    The commented line is the original code, which did not work because the RecordFields dictionary contains the wrong guide as keys (ie not the record FieldKeys):

    bad guids!!

    If somebody can tell me why this is, please tell, this code worked fine on U6.0.6 and Contour 3.0.19 ...

    That left me with having to use the new Membership system of 6.2.0:

    At the beginning of the WorkFlow Execute, you can call:

    var ms = ApplicationContext.Current.Services.MemberService;
    

    Some more modifications are needed:

    if (int.TryParse(System.Web.Security.Membership.GetUser().ProviderUserKey.ToString(), out mId))
          {
              //Member m = new Member(mId);
              Umbraco.Core.Models.Member m = (Umbraco.Core.Models.Member)ms.GetById(mId);
    ...
    
    //foreach (Property p in m.getProperties)
           foreach (Umbraco.Core.Models.Property p in m.Properties)
           {
    
               try
               {
    
                   //if (mappings.ContainsKey(p.PropertyType.Alias))
                   if (mappings.ContainsKey(p.Alias))
    
                   ...
    
                   m.SetValue(p.Alias, mappings[p.Alias]);
    
               }
    

    Last but not least:

    ms.Save(m);
    //m.XmlGenerate(new System.Xml.XmlDocument());
    //m.Save();
    

    This restores member update functionality for the workflow but sadly, member properties are still being cached somewhere so it takes for this cache to expire before any updates become visible elsewhere on the Front End... So I still really would like to know how this can be fixed.

  • Kris Janssen 210 posts 569 karma points c-trib
    Jun 25, 2014 @ 07:11
    Kris Janssen
    100

    Check here for some working code to interact with the membership system in U7. It is not exactly Contour but one should be able to get the basic idea.

    I might post a Contour specific update later on.

Please Sign in or register to post replies

Write your reply to:

Draft