Copied to clipboard

Flag this post as spam?

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


  • MrFlo 159 posts 403 karma points
    Dec 02, 2015 @ 12:16
    MrFlo
    0

    Member saved event

    Hello,

    I having problems on setting value to some properties in a member saved event or created events (I have tried both).

    private void MemberService_Created(IMemberService sender, NewEventArgs<IMember> e)
    {
            var member = e.Entity;
            if (member.IsNewEntity())
            {
                int mediaFolder = 1052;
                //Umbraco.MultiNodeTreePicker NOT SAVED
                member.SetValue("mediafolderid", mediaFolder);
                //Media picker NOT SAVED tried as string or Int
                member.SetValue("testfolderid", mediaFolder.ToString());
                // This is saved
                member.SetValue("umbracoMemberComments", "bou"+ mediaFolder.ToString());
                //Not saved but this seems a know bug.
                sender.AssignRole(member.Id, "Member");
                //using sender or applicationcontext seems to work 
                ApplicationContext.Current.Services.MemberService.Save(member,false);
            }
    
    }
    

    Is someone experienced that kind of behaviour ? Thanks

  • Matthieu Nelmes 102 posts 385 karma points
    Dec 02, 2015 @ 12:27
    Matthieu Nelmes
    0

    I'm not 100% but I think MultinodeTreePicker values are saved as comma delimited string of Node Id's

    also, with the media picker value, I cannot see where you're setting memberFolder?

  • MrFlo 159 posts 403 karma points
    Dec 02, 2015 @ 14:52
    MrFlo
    0

    Thanks for you answer.

    Yes it needs a comma delimited string like: https://our.umbraco.org/forum/umbraco-7/using-umbraco-7/59667-SetValue-with-Multiple-Media-picker but I am saving only one id.

    I removed the code of the memberfolder you should read mediaFolder.ToString().

  • MrFlo 159 posts 403 karma points
    Dec 04, 2015 @ 16:27
    MrFlo
    0

    Hi,

    It looks like there is a bug with all custom properties in those events. I can't get or set the Value of those properties...

    This should be due to a bug in this API linked to this issue: http://issues.umbraco.org/issue/U4-6366

    Anyone has experience this ?

  • Alex Skrypnyk 6182 posts 24283 karma points MVP 8x admin c-trib
    Mar 22, 2016 @ 13:31
    Alex Skrypnyk
    1

    Hi MrFlo,

    If this problem is actual for you, try to use:

    MemberService.Saved += (sender, e) =>
                {
                    foreach (var saved in e.SavedEntities)
                    {
                        saved.SetValue("fieldAlias", true);
    
                        sender.Save(saved, false);
                    }
                };
    

    Thanks, Alex

  • This forum is in read-only mode while we transition to the new forum.

    You can continue this topic on the new forum by tapping the "Continue discussion" link below.

Please Sign in or register to post replies