Products

Solutions

Resources

Partners

Community

Blog

About

QA

Ideas Test

New Community Website

Ordinarily, you'd be at the right spot, but we've recently launched a brand new community website... For the community, by the community.

Yay... Take Me to the Community!

Welcome to the DNN Community Forums, your preferred source of online community support for all things related to DNN.
In order to participate you must be a registered DNNizen

HomeHomeDNN Open Source...DNN Open Source...Module ForumsModule ForumsForumForumProgrammatically posting to a forumProgrammatically posting to a forum
Previous
 
Next
New Post
1/1/2010 4:18 PM
 

HI,

I am currently working on a website where there is a need for me to create a thread/post (Like an announcement or notification) in a given forum.

Has anyone done this before? Any  pointers or suggestions.

I can look into the forum source code (which I am not familiar though) and find out how posts are made. But I thought if anyone can give their thoughts in a simple manner, I can work towards it.

 

Thanks

 
New Post
1/2/2010 11:20 PM
 

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. 


Chris Paterra

Get direct answers to your questions in the Community Exchange.
 
New Post
1/26/2010 7:02 PM
 

Thanks Crispy.!!!

 
Previous
 
Next
HomeHomeDNN Open Source...DNN Open Source...Module ForumsModule ForumsForumForumProgrammatically posting to a forumProgrammatically posting to a forum


These Forums are dedicated to discussion of DNN Platform and Evoq Solutions.

For the benefit of the community and to protect the integrity of the ecosystem, please observe the following posting guidelines:

  1. No Advertising. This includes promotion of commercial and non-commercial products or services which are not directly related to DNN.
  2. No vendor trolling / poaching. If someone posts about a vendor issue, allow the vendor or other customers to respond. Any post that looks like trolling / poaching will be removed.
  3. Discussion or promotion of DNN Platform product releases under a different brand name are strictly prohibited.
  4. No Flaming or Trolling.
  5. No Profanity, Racism, or Prejudice.
  6. Site Moderators have the final word on approving / removing a thread or post or comment.
  7. English language posting only, please.
What is Liquid Content?
Find Out
What is Liquid Content?
Find Out
What is Liquid Content?
Find Out