I've recently tried to have my own
Java web app interface with JForum, eg. programmatically make posts, edit posts, delete posts.
After finding only bits and pieces of info on this forum for how to do this, but nothing comprehensive, I would like to share with you a hopefully more complete set of steps for achieving this.
I used commons http-client
http://jakarta.apache.org/commons/httpclient/ to simulate a http client.
[CREATING TOPIC]
You can create a new topic in JForum by entering a URL similar to this:
http://localhost:8080/jforum/jforum.page?module=posts&action=insertSave&forum_id=1&subject=new topic subject&message=This is is a new subject
You can put that URL in the browser and it will automatically create a topic in the forum with forum_id = 1, and subject = "new topic subject",
and message = "This is is a new subject".
To achieve this in a java application using Commons Http-Client, you can use the following code:
[EDITING POST]
Say you wanted to edit a post with post_id = 8 in forum with forum_id = 1, the following URL when put into the browser will do it:
http://localhost:8080/jforum/jforum.page?module=posts&action=editSave&post_id=8&forum_id=1&topic_type=0&message=A NEW CONTENT&subject=A NEW SUBJECT
To do this in java:
[DELETE TOPIC]
The following url will delete a topic with the topic_id = 5, forum_id = 1.
http://localhost:8080/jforum/jforum.page?action=doModeration&module=moderation&forum_id=1&topic_id=5&topicRemove=1&returnUrl=/jforum
To do this in java:
[LOG IN AS ADMIN]
This method will log you in as the default admin (u: Admin, p: admin):
####################################
I hope this post is useful to somebody. I also hope the code works as I had to extract bits and pieces from my files so it hasnt been through a compiler.
This may not be the best or the only way to programmatically interface with JForum, but it has worked for me.
I learnt a lot about how to communicate with JForum using Firefox's Live Http Headers (
http://livehttpheaders.mozdev.org/), which shows you the headers in requests.
[originally posted on jforum.net by gambit_asdf]