File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes JForum and the fly likes Need help to create Categories in JForum Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Products » JForum
Bookmark "Need help to create Categories in JForum" Watch "Need help to create Categories in JForum" New topic
Author

Need help to create Categories in JForum

Migrated From Jforum.net
Ranch Hand

Joined: Apr 22, 2012
Posts: 17424


Hi,

I want to create a no. of Categories by a single click (programmatically). How can I do that? How the code is working to create the category?

Can anyone please help me to resolve this issue?

Your kind & early reply is soliciated.

Thanking you in advance.

-- Kunal



[originally posted on jforum.net by kunal2383]
Migrated From Jforum.net
Ranch Hand

Joined: Apr 22, 2012
Posts: 17424
If you need this one time only, just insert the records in the table jforum_categories and restart JForum. If you will need it many times, use a library like commons-httpclient and build requests to the respective action in the admin (CategoryAction, method insertSave).

To know which url should be used and which parameters send, take a look in the html form of the file templates/default/admin/category_form.htm

Baiscally, you need to send the following parameters:

:arrow: module = adminCategories
:arrow: action = insertSave
:arrow: category_name = <the name>
:arrow: moderate = 0 or 1 (0 false, 1 true)
:arrow: groups = at least one group id. More than one, repeat the argument (like groups=1&groups=2&groups=3)

Rafael
[originally posted on jforum.net by Rafael Steil]
Migrated From Jforum.net
Ranch Hand

Joined: Apr 22, 2012
Posts: 17424
Hi,

Following to some code examples on the forum here, I've put together this code to add categories programatically.




I do have a problem. When I execute the method using line 111:



I get statuscode 302. This means the method has been moved or something.


I'm not sure if my above code is correct. I had to add something to authenticate as I'm performing an admin operation. Also don't know if this is the correct way to authenticate in JForum.

Somebody who can help?
[originally posted on jforum.net by jeetn]
Migrated From Jforum.net
Ranch Hand

Joined: Apr 22, 2012
Posts: 17424
When I receive the 203 statuscode, I respond with doing the following:



When I do this I'm being redirected to the login page of JForum.

So I still need to figure out a way to authenticate myself.

This is my current code. Some changes were made:


[originally posted on jforum.net by jeetn]
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Need help to create Categories in JForum