• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Tim Cooke
  • Devaka Cooray
Sheriffs:
  • Liutauras Vilda
  • paul wheaton
  • Rob Spoor
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Piet Souris
  • Mikalai Zaikin
Bartenders:
  • Carey Brown
  • Roland Mueller

Need help to create Categories in JForum

 
Ranch Hand
Posts: 17424
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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]
 
Yes, of course, and I accept that blame. In fact, i covet that blame. As does this tiny ad:
We need your help - Coderanch server fundraiser
https://coderanch.com/wiki/782867/Coderanch-server-fundraiser
reply
    Bookmark Topic Watch Topic
  • New Topic