The editors in my current project use gadgets a lot; both built-in and the custom ones developed by us. Those gadgets can be placed anywhere on the screen.
After we updated our EPiServer version to 7.19 and additionally updated .NET framework to 4.5 some gadgets simply disappeared or started to display incorrectly.
That resulted in empty areas and effectively made the the right hand side gadget panel look ugly.
All the regular functionalities like page editing, page tree etc. were intact. Clearing the browser’s cache and cookies did not help so we came to a conclusion that this must have been related to UI rendering.
I tried to find a way to fix that issue but ultimately I gave up. The best workaround that I came up with was to reset all users’ view to the default.
It worked like a charm – all gadgets were restored to their initial state. Of course, they had to set up their widgets again, but still, the page was fully functional again.
I tested it for a single user by using the My Settings->Display Options->Reset Views and it seemed to work fine, however we have a lot of editors and it would take a lot of time explaining each of them how to reset their own view so I decided to write a piece of code that can clear those settings for all users directly in the database.
The code snipped below enumerates through all membership users and simply removes all settings from the ViewSettingsRepository.
I implemented it as an admin mode plugin.
1 2 3 4 5 6 7 8 9 10 |
var viewSettingsRepository = ServiceLocator.Current.GetInstance<IPersonalizedViewSettingsRepository>(); var users = Membership.GetAllUsers(); foreach (MembershipUser user in users) { var principal = PrincipalInfo.CreatePrincipal(user.UserName); foreach (var personalizedViewSettings in viewSettingsRepository.Load(principal)) { viewSettingsRepository.Delete(principal, personalizedViewSettings.ViewName); } } |