Win a copy of The Java Performance Companion this week in the Performance forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Need help to create Categories in JForum

 
Migrated From Jforum.net
Ranch Hand
Posts: 17424
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator


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
Posts: 17424
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 17424
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 17424
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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]
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic