vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB3 General Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=111)
-   -   Automatically creating forums (https://vborg.vbsupport.ru/showthread.php?t=107208)

DB03 02-05-2006 02:57 PM

Automatically creating forums
 
Is there anyway I can run a script to automatically create a forum (instead of doing it through the admin cp)? I tried adding an entry to the forum database but it seems like I might have to add another entry somewhere as it does not show up in the admin cp. Thanks.

Marco van Herwaarden 02-05-2006 08:04 PM

What is it you are trying to achieve?

DeMiNe0 03-07-2006 11:35 PM

I have the same question. I have a set of about 10 forums that takes me an extra half hour to create every time i need to add new ones. If i can just run a query or script to make them all in one shot, it would speed things up alot.

zell_11 03-08-2006 02:55 PM

What like having carbon copy forums that runs x amount of time. So the forums would have same premissions, same moderator, same parent catagory but diffrent name?

Tell me if this is what you are looking for

DeMiNe0 03-10-2006 01:06 AM

yes. exactly. All i would need to do is run a script and imput the names i want the forums to have,

DeMiNe0 03-11-2006 09:00 PM

This is becoming harder then i thought to do lol.

Borgs8472 03-11-2006 09:13 PM

On topic, some command line type functions might be helpful as an alternative to the admincp at times.

nitro 03-11-2006 10:29 PM

why dont you just drop your query into the query box in cp or phpmyadmin ?

You could probably run a php script at command line with args as well so you would just do something like this in ssh #php newforum.php blabla and the php script as long as it had the right query would just do what you wanted.

merk 03-12-2006 07:42 AM

You can just add the entries via SQL, but you will have to rebuild the forum information, easiest way is to edit a forum then save it.

Harder way would be to look for the correct datastore function to rebuild forum information.

OR - use the forum datamanager.

thomberg 05-12-2006 11:12 AM

Datamanager i wrote to create a forum:

PHP Code:

<?php
define
('THIS_SCRIPT','datamanager');
define('SKIP_SESSIONCREATE',true);
chdir('..'); // change directory to your forum home with global.php in it
require_once('./global.php');

if (
count($_SERVER['argv']) < 3) die ("Usage: ".__FILE__." <forumname> <parentid>  [<description>]\n");

$forumdata =& datamanager_init('Forum'$vbulletinERRTYPE_ARRAY); 

// arguments
$forumdata->set('title'$_SERVER['argv'][1]); 
$forumdata->set('parentid'$_SERVER['argv'][2]); 
if (
$_SERVER['argv'][3]) $forumdata->set('description'$_SERVER['argv'][3]); 

// your default settings
$forumdata->set('displayorder'1); 
$forumdata->set_bitfield('options''active'1);  
$forumdata->set_bitfield('options''allowposting'1);  
$forumdata->set_bitfield('options''cancontainthreads'1);  
$forumdata->set_bitfield('options''moderatenewpost'0);  
$forumdata->set_bitfield('options''moderatenewthread'0);  
$forumdata->set_bitfield('options''moderateattach'0);  
$forumdata->set_bitfield('options''allowbbcode'1);  
$forumdata->set_bitfield('options''allowimages'1);  
$forumdata->set_bitfield('options''allowhtml'0);  
$forumdata->set_bitfield('options''allowsmilies'1);  
$forumdata->set_bitfield('options''allowicons'1);  
$forumdata->set_bitfield('options''allowratings'0);  
$forumdata->set_bitfield('options''countposts'1);  
$forumdata->set_bitfield('options''canhavepassword'0);  
$forumdata->set_bitfield('options''indexposts'1);  
$forumdata->set_bitfield('options''styleoverride'0);  
$forumdata->set_bitfield('options''showonforumjump'1);  
$forumdata->set_bitfield('options''warnall'0);  


// check for errors 
if (!empty($forumdata->errors)) 

    
$errorlist ''
    foreach (
$forumdata->errors AS $index => $error
    { 
        
$errorlist .= $error."\n"
    } 
         echo 
$errorlist;
     
    
// ... additional code; $errorlist is outputted to the user 

else 

    
// save the data 
    
    
$vbulletin->userinfo['forumid'] = $forumid $forumdata->save(); 
echo 
$forumid;
}  

?>



All times are GMT. The time now is 09:29 AM.

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.01039 seconds
  • Memory Usage 1,762KB
  • 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_php_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (1)pagenav_pagelink
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (10)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
  • pagenav_page
  • pagenav_complete
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete