In the last release I created an API for this very thing. In fact, even posting via this module basically uses the very same API. I have yet to document this and provide a sample, because I am not certain it is 100% final, but I can give a briefing on it now. Basically, you need to reference the DotNetNuke.Modules.Forum.dll to get started. Inside this there is a class PostConnector. In this class there are only 3 functions: SubmitExternalPost, ProcessPostBody, ProcessPostSubject.
You should use the Process functions for subject and/or body prior to submission ONLY for the reasons of preview, these will also be called by the SubmitExternalPost method during the post time so there is no need to do it prior to submission. The API will take care of all security, moderation, notifications, filtering, etc, so basically just make sure you are providing accurate parameters to the method SubmitExternalPost:
- TabID: The page your forum module resides on.
- ModuleID: The module you wish to post to.
- PortalID: The portal associated w/ the module/tab/forum.
- UserID: This is the person posting.
- PostSubject: This should be your 'uncleansed' post subject.
- PostBody: This should be your 'uncleansed' post body.
- ForumID: The forum you are posting to.
- ParentPostID: If you are creating a new thread, this is 0. If you are replying to an existing, this would be that postid.
- Attachments: This would be a string of attachments, separated by ;. I really recommend against using this at all for now (just pass in an empty string).
- Provider: This is just a string that perhaps someday will have some set values but for now I would make my own to identify your method.
This function will return one of the following (I don't see these reasons changing, perhaps added to in future):
- ForumClosed = 0
- ForumDoesntExist = 1
- ForumIsParent = 2
- ForumNoAttachments = 3
- PostApproved = 4
- PostEditExpired = 5
- PostInvalidBody = 6
- PostInvalidSubject = 7
- PostModerated = 8
- ThreadLocked = 9
- UserAttachmentPerms = 10
- UserBanned = 11
- UserCannotEditPost = 12
- UserCannotPostReply = 13
- UserCannotStartThread = 14
- UserCannotViewForum = 15
I haven't really grilled this in terms of testing but the module uses the same methods this does so it should work fine. One final note, I have not done this to allow any post editing, so that is not currently possible. Let me know how it goes.