Skip to main content
updated answer
Source Link
Sumit Bhatia
  • 5.9k
  • 2
  • 9
  • 25

You can also try this with an Update event like this.

<configuration xmlns:patch="http://www.sitecore.net/xmlconfig/">
  <sitecore>
    <events>
      <event name="user:updated">
        <handler type="Custom.UserUpdatedEventHandler, Custom" method="OnUserUpdated"/>
      </event>
      <event name="user:updated:remote">
        <handler type="Custom.UserUpdatedEventHandler, Custom" method="OnUserUpdatedRemote"/>
      </event>
    </events>
  </sitecore>
</configuration>

See this thread for more details.

How to send email, when users roles change - User Manager customization

I hope this will help.

I hope this will help.

You can also try this with an Update event like this.

<configuration xmlns:patch="http://www.sitecore.net/xmlconfig/">
  <sitecore>
    <events>
      <event name="user:updated">
        <handler type="Custom.UserUpdatedEventHandler, Custom" method="OnUserUpdated"/>
      </event>
      <event name="user:updated:remote">
        <handler type="Custom.UserUpdatedEventHandler, Custom" method="OnUserUpdatedRemote"/>
      </event>
    </events>
  </sitecore>
</configuration>

See this thread for more details.

How to send email, when users roles change - User Manager customization

I hope this will help.

Source Link
Sumit Bhatia
  • 5.9k
  • 2
  • 9
  • 25

If you see the code for the Edit User Dialogue from the User Manager, here is the location of the file in the Sitecore webroot.

inetpub\wwwroot\<your application root>\sitecore\shell\Applications\Security\EditUser\EditUser.xaml.xml

This file refers to the DLL i.e. Sitecore.Client and the event is written in this class Sitecore.Shell.Applications.Security.EditUser.EditUserPage. And here is the code snippet to add Edit User or Role.

protected override void OK_Click()
{
  if (!this.Validate() || !this.ValidateTicket())
    return;
  User user = EditUserPage.GetUser();
  Assert.IsNotNull((object) user, typeof (User), "User not found");
  UserProfile profile = user.Profile;
  Assert.IsNotNull((object) profile, typeof (UserProfile));
  try
  {
    IEnumerable<Role> roles = this.Roles.Items.Cast<System.Web.UI.WebControls.ListItem>().Where<System.Web.UI.WebControls.ListItem>((Func<System.Web.UI.WebControls.ListItem, bool>) (item => System.Web.Security.Roles.RoleExists(item.Value))).Select<System.Web.UI.WebControls.ListItem, Role>((Func<System.Web.UI.WebControls.ListItem, Role>) (item => Role.FromName(item.Value)));
    HttpContext current = HttpContext.Current;
    Assert.IsNotNull((object) current, typeof (HttpContext));
    string controlValue = string.Empty;
    foreach (string key in current.Request.Form.Keys)
    {
      if (key != null && key.EndsWith("StartUrlSelector", StringComparison.InvariantCulture))
      {
        controlValue = current.Request.Form[key];
        break;
      }
    }
    if (controlValue == "Default")
      controlValue = string.Empty;
    if (controlValue == "Custom")
      controlValue = this.StartUrl.Text;
    user.Roles.Replace(roles);
    ....
    ....
}

So you can override this class and replace it in the XML file to use your logic.

I hope this will help.