Copied to clipboard

Flag this post as spam?

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


  • Marianne Hildesheim Bertelsen 1 post 21 karma points
    Jun 23, 2014 @ 15:58
    Marianne Hildesheim Bertelsen
    0

    BeforeSave event on Member in v. 4.11.8 firing after actual save

    Hi 

    I'm working on an Umbraco site which (unfortunately) runs v4.11.8, IE. I'm using the old API.

    I'm trying to send an e-mail when a user goes from being inactive (default) to being active. This property is set in the backoffice using a checkbox.

    I'm using the Member.BeforeSave event in which I was hoping to do something like the following:

    var newValue = sender.getProperty("active").Value;
    var oldValue = new umbraco.cms.businesslogic.member.Member(sender.Id).getProperty("active").Value;
    // Send email if the property was changed

     

    But by debugging and reading on the forum it seems that the member is already saved when the BeforeSave event is fired, meaning that I don't have a chance to get the old value of the property before it's overwritten by the new value.

    From reading on the forum I gather that there was an error(?) in an earlier version of Umbraco 4 in which the property was saved immediately after it was edited, making BeforeSave occur after the actual save. But I also read that this error was corrected in a later version of Umbraco 4, but only for the Document.BeforeSave event?

    Does anybody know if this error was never corrected for the Member.BeforeSave event? Or perhaps if there is some way I can get the old value of the property before it is overwrittten?

    I haven't got that much experience with Umbraco (~2 months) so I may be overlooking something basic :-)

Please Sign in or register to post replies

Write your reply to:

Draft