Kentico CMS 6.0 Developer's Guide

Managing ignore lists

Managing ignore lists

Previous topic Next topic Mail us feedback on this topic!  

Managing ignore lists

Previous topic Next topic JavaScript is required for the print function Mail us feedback on this topic!  

Arrow


API examples for newer versions


Please visit the latest API Examples documentation to view API examples for newer versions of Kentico.



The following example adds the cmseditor user to the current user's ignore list.

 

private bool AddUserToIgnoreList()

{

  // Gets "cmseditor" UserInfo object

  UserInfo user = UserInfoProvider.GetUserInfo("cmseditor");

 

  if (!IgnoreListInfoProvider.IsInIgnoreList(CMSContext.CurrentUser.UserID, user.UserID))

   {

      // Adds "cmseditor" to the current user's ignore list

      IgnoreListInfoProvider.AddToIgnoreList(CMSContext.CurrentUser.UserID, user.UserID);

 

      return true;

   }

 

  return false;

}

 

The following example removes the cmseditor user from the current user's ignore list.

 

private bool RemoveUserFromIgnoreList()

{

  // Gets "cmseditor" UserInfo object

  UserInfo user = UserInfoProvider.GetUserInfo("cmseditor");

 

  if (IgnoreListInfoProvider.IsInIgnoreList(CMSContext.CurrentUser.UserID, user.UserID))

   {

      // Removes "cmseditor" from the current user's ignore list

      IgnoreListInfoProvider.RemoveFromIgnoreList(CMSContext.CurrentUser.UserID, user.UserID);

 

      return true;

   }

 

  return false;

}