Hey Brian,
I have been struggling with what seems to be an application scope caching issue. The Forum module cache is set to -1, but for some reason, the forumID is -1 when I call the database to get the newly created forum (so I can add a post to it). In my update event I have the following (partial) code.
if (chkAddForum.Checked && (chit.ThreadID == 0 || chit.ThreadID == -1))
{
// Perform Forum Discovery based on Module Title (if one doesn't exist this functions stored procedure creates and returns the new forum record)
ForumInfo forum = ctlActionChits.GetActionChitForum(ddlCommittee.SelectedItem.Text);
int retval = ctlPost.PostAdd(0, forum.ForumID, dnnUser.UserID, Request.UserHostAddress, true, txtSubject.Text, txtDescription.Content, false, Null.NullDate, false, 0, string.Empty, moduleInfo.PortalID, -1, -1);
// Syncronize forum module and clear the cache so new forum will be displayed
ctlForum.ClearCache_ForumGetAll(forum.GroupID);
ModuleController.SynchronizeModule(forum.ModuleID);
PostInfo post = ctlPost.PostGet(retval, moduleInfo.PortalID);
chit.ThreadID = post.ThreadID; // Errors here
}
The error occurs on the last line when I step through the code. The real problem is that my forum.ForumID is -1 instead of the actual forumID. A quick database check reviels that the record exists.
Finally, when I browse the forums module as Host, the group count in Edit Groups is correct, but the forum is not displayed in the module. Browsing to HostSettings and clearing the cache then restarting the application will cause my newly created forum to be displayed and all behaviors are normal.
Any thoughts?