vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB3 Programming Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=15)
-   -   Create new vBulletin forum script (https://vborg.vbsupport.ru/showthread.php?t=135900)

ierse010 01-08-2007 04:14 PM

Create new vBulletin forum script
 
I'm building a system in which another tool on the server should create a new forum on my vBulletin board.

Is there any vBulletin documentation available for adding a new Forum in a certain parent_id with given properties? Can I use vBulletin php functions to do this?

Is it posible to include functions for adding the new forum in my own script?

kg4mxz 01-14-2007 07:37 PM

This function would be very useful, as I am looking to do the same thing :)

I know it is possible with a MySQL query, but I would really like to use the datamanager.

simsimt 01-14-2007 07:52 PM

<a href="http://members.vbulletin.com/api" target="_blank">http://members.vbulletin.com/api</a>

WhaLberg 01-14-2007 07:55 PM

Quote:

I know it is possible with a MySQL query, but I would really like to use the datamanager.
Data Managers help so much. ;)

kg4mxz 01-14-2007 09:05 PM

Have looked at the API, but I would really appreciate an example, as the API is way over my head

AN-net 01-15-2007 02:42 AM

take a look at the admincp folder in manage forum files. the code for how vbulletin creates new forums is in them.

ierse010 01-15-2007 07:26 AM

thanks a lot!

Which class / method should i use from this api?

I figured it out!

Here's how to create a forum using the datamanager API:

Code:

$forum = array(
'title' => 'Forum name',
'description' => '',
'link' => '',
'displayorder' => 1,
'daysprune' => -1,
'parentid' => 1,
'newthreademail' => '',
'newpostemail' => '',
'options' => array(
'moderatenewpost' => 0,
'moderatenewthread' => 0,
'moderateattach' => 0,
'warnall' => 0,
'styleoverride' => 0,
'canhavepassword' => 1,
'cancontainthreads' => 0,
'active' => 1,
'allowposting' => 0,
'indexposts' => 0,
'allowhtml' => 0,
'allowbbcode' => 1,
'allowimages' => 1,
'allowsmilies' => 1,
'allowicons' => 1,
'allowratings' => 0,
'countposts' => 0,
'showonforumjump' => 1),
'styleid' => -1,
'password' => '',
);

$forumdata =& datamanager_init('Forum', $vbulletin, ERRTYPE_CP);
foreach ($forum AS $varname => $value)
{
    if ($varname == 'options')
    {
        foreach ($value AS $key => $val)
        {
            $forumdata->set_bitfield('options', $key, $val);
        }
    }
    else
    {
        $forumdata->set($varname, $value);
    }
}

$forumid = $forumdata->save();



All times are GMT. The time now is 04:48 PM.

Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.

X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.01087 seconds
  • Memory Usage 1,726KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)bbcode_code_printable
  • (1)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (7)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • printthread_start
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete