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;
}  

?>


Marco van Herwaarden 05-14-2006 03:03 PM

I hope you do realize that anyone can create a new forum with that script???

Depending on your settings, even guests could do it.

thomberg 05-14-2006 07:45 PM

This script gets called by commandline/cronjob

It is not under the document root. So nobody is able to start this script without shell access and execution permissions.


All times are GMT. The time now is 04:54 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.01395 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)post_thanks_navbar_search
  • (1)printthread
  • (12)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