Copied to clipboard

Flag this post as spam?

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


  • Pradeep 39 posts 158 karma points
    Aug 12, 2015 @ 20:54
    Pradeep
    0

    Member saved event error

    Hello every one ,

    I have an issue , that I created a member created event , but its a saved event.

    What is problem.

    1. How I able to create an event that only fire when member account created , not fire when member prop. is updated or saved.

    2. After making some changes in member property as like change information (name , address) , its stop working , none of change will be saved.

    And I found following warning in log.text

    Please share your idea , how I can fix it .

    waiting for help...

    Error on member event fire

      protected override void ApplicationStarted(UmbracoApplicationBase umbracoApplication, ApplicationContext applicationContext)
        {
            Umbraco.Core.Services.MemberService.Saved += MemberService_Saved;
    
    
        }
    
        void MemberService_Saved(IMemberService sender, Umbraco.Core.Events.SaveEventArgs<IMember> e)
        {
    
            int count = 0;
            string email= "" ;
            string bname = "";
            string pass ="";
            string username ="";
            foreach (var item in e.SavedEntities)
            {
                count++;
                if (count == 1 && item.ContentTypeAlias == "mynh")
                {
                            email = item.Email;
                            bname= item.Name;
                            pass=item.RawPasswordValue.ToString();
                            username= item.Username;
    
                }
            }
    
            sendmail(email, bname, pass, username);
    
    
        }
    
  • Dave de Moel 122 posts 574 karma points c-trib
    Aug 13, 2015 @ 09:43
    Dave de Moel
    1

    1.How I able to create an event that only fire when member account created , not fire when member prop. is updated or saved.

    Use "MemberService.Created" instead of "MemberService.Saved".

    As far as the second issue goes my guess is you are not trying to access the properties correctly. Try using "member.GetValue([propertyTypeAlias])" as that should work.

    Also, "item.RawPasswordValue.ToString" only returns a hash, so is useless if you want to mail the users password. And you can not decript the password. My suggestion would be to let the member create a password on a page that can only be used when using a unique identifier that gets send in the mail and identifies the user ("http://yoursite.com/setPassword?id=6a6a7f67a86f6"). You could use the "member.Key" property for that if the site is a low risk website.

  • Pradeep 39 posts 158 karma points
    Aug 13, 2015 @ 15:13
    Pradeep
    0

    Hi , thanks for reply ,

    Its works fine , but I have an issue in uwebshop ?

    How I setup emails in uwebshop , so when order placed , a email sent out.

    Currently I tried to set all setting according to uwebshop , but its not working ,

    Can please suggest any way , how I can do that

    Thanks Waiting for reply

Please Sign in or register to post replies

Write your reply to:

Draft