Below is an example of the Saving event and setting a member property value:
using Umbraco.Core;
using Umbraco.Core.Events;
using Umbraco.Core.Models;
using Umbraco.Core.Services;
namespace MyApplication.Events
{
public class MemberSavingEvent : ApplicationEventHandler
{
public MemberSavingEvent()
{
MemberService.Saving += MemberServiceOnSaving;
}
private static void MemberServiceOnSaving(IMemberService sender, SaveEventArgs saveEventArgs)
{
foreach (var member in saveEventArgs.SavedEntities)
{
member.SetValue("propertyAlias", "value");
}
}
}
}
Hi is it possible to notify user if I cancel (e.Cancel = true) the event? I try throw application exception, using standart umbraco notification looks better.
Member.AfterSave
Hi,
Before i could call my own custom method, when the member is saved.
I understand that it has been changed in 7.14.
Something with 'MemberService.Saving'
Do anyone have an example, i cant seem to find any?
Hi Peter,
Below is an example of the Saving event and setting a member property value:
using Umbraco.Core; using Umbraco.Core.Events; using Umbraco.Core.Models; using Umbraco.Core.Services; namespace MyApplication.Events { public class MemberSavingEvent : ApplicationEventHandler { public MemberSavingEvent() { MemberService.Saving += MemberServiceOnSaving; } private static void MemberServiceOnSaving(IMemberService sender, SaveEventArgs saveEventArgs) { foreach (var member in saveEventArgs.SavedEntities) { member.SetValue("propertyAlias", "value"); } } } }Thanks,
Dan.
Perfect, thanks
Hi is it possible to notify user if I cancel (e.Cancel = true) the event? I try throw application exception, using standart umbraco notification looks better.
is working on a reply...
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.