How to add custom field to role (CMS_Role) table
This article shows you how you can modify the CMS_Role table and add a custom field.
You can add your own field into
CMS_Role table in database. However, you would also need to refresh
XMLSchema and
FormDefinition of
CMS_Role table using following code (you need to execute it) before using this custom role field:
DataClassInfo dci = DataClassInfoProvider.GetDataClass("cms.role");
if (dci != null)
{
dci.ClassXmlSchema = CMS.DataEngine.TableManager.GetXmlSchema("CMS_Role");
DataClassInfoProvider.SetDataClass(dci);
// Generate queries
SqlGenerator.GenerateDefaultQueries(dci, true, false);
}
Please note that since CMS.Role class is not default system table, you might lose your custom field after upgrading.
See also: Applies to: Kentico CMS 4.0