Skip to content

Instantly share code, notes, and snippets.

@hishaamn
Last active March 19, 2017 19:27
Show Gist options
  • Save hishaamn/712885ac9df21eebb8f5daeacf2a6d5f to your computer and use it in GitHub Desktop.
Save hishaamn/712885ac9df21eebb8f5daeacf2a6d5f to your computer and use it in GitHub Desktop.
public class EnforceEntireTree
{
public void Process(LoggedInArgs args)
{
User user = User.FromName(args.Username, true);
Assert.IsNotNull(user, "user");
string key = "/" + user.Name + "/UserOptions.View.ShowEntireTree";
user.Profile.Initialize(user.Name, true);
user.Profile[key] = "true";
user.Profile.Save();
// Get the shell site here
var site = Sitecore.Sites.SiteContext.GetSite("shell");
RegistryCache registryCache = CacheManager.GetRegistryCache(site );
registryCache.Clear();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment