That will be very helpful with other items. I've attempted to implement this as you mention and have been less than successful. It, runs an infinate loop. All I want to do is when someone logs in, I want to the the LastLogon date (before it is updated) and save it in a custom field in the user settings table. Also this code is showing the user has already been updated so the Authentication process must be updating that LastLogon property before the Object.Update.Before event is fired. Any thoughts on this code?
private void User_Authenticate_Before(object sender, ObjectEventArgs e)
if (e.Object.ObjectType.ToLower() == "cms.user")
// update the user settings to save the previous login date
// get the settings for the current user
UserInfo ui = UserInfoProvider.GetUserInfo(e.Object.GetIntegerValue("UserID", -1));
if (ui != null)
// probably need to compare the dates so its not updating everytime the user object is updated.
UserSettingsInfo usi = UserSettingsInfoProvider.GetUserSettingsInfo(ui.UserSettings.UserSettingsID);
usi.SetValue("UserLastAccountActivity", ValidationHelper.GetDateTime(ui.LastLogon, DateTime.Now));