privatevoid CreateForumGroup() { // Create new forum group object ForumGroupInfo newGroup = newForumGroupInfo(); // Set the properties newGroup.GroupDisplayName = "My new group"; newGroup.GroupName = "MyNewGroup"; newGroup.GroupSiteID = CMSContext.CurrentSiteID; newGroup.GroupAuthorDelete = true; newGroup.GroupAuthorEdit = true; newGroup.GroupDisplayEmails = true; // Save the forum group ForumGroupInfoProvider.SetForumGroupInfo(newGroup); }
The following example gets and updates a forum group.
privatebool GetAndUpdateForumGroup() {
// Get the forum group ForumGroupInfo updateGroup = ForumGroupInfoProvider.GetForumGroupInfo("MyNewGroup", CMSContext.CurrentSiteID);
if (updateGroup != null) { // Update the properties updateGroup.GroupDisplayName = updateGroup.GroupDisplayName.ToLower(); // Save the changes ForumGroupInfoProvider.SetForumGroupInfo(updateGroup); returntrue; } returnfalse; }
The following example gets and bulk updates forum groups.
privatebool GetAndBulkUpdateForumGroups() { // Prepare the parameters string where = "GroupName LIKE N'MyNewGroup%'"; string orderBy = ""; string columns = ""; int topN = 10;
// Get the data DataSet groups = ForumGroupInfoProvider.GetGroups(where, orderBy, topN, columns);
if (!DataHelper.DataSourceIsEmpty(groups)) { // Loop through the individual items foreach (DataRow groupDr in groups.Tables[0].Rows) { // Create object from DataRow ForumGroupInfo modifyGroup = newForumGroupInfo(groupDr); // Update the properties modifyGroup.GroupDisplayName = modifyGroup.GroupDisplayName.ToUpper(); // Save the changes ForumGroupInfoProvider.SetForumGroupInfo(modifyGroup); } returntrue; } returnfalse; }
The following example deletes a forum group.
privatebool DeleteForumGroup() {
// Get the forum group ForumGroupInfo deleteGroup = ForumGroupInfoProvider.GetForumGroupInfo("MyNewGroup", CMSContext.CurrentSiteID);
// Delete the forum group ForumGroupInfoProvider.DeleteForumGroupInfo(deleteGroup); return (deleteGroup != null); }