Go Back   vb.org Archive > Community Discussions > Modification Requests/Questions (Unpaid)
FAQ Community Calendar Today's Posts Search

Reply
 
Thread Tools Display Modes
  #1  
Old 02-11-2004, 02:49 AM
Wired1's Avatar
Wired1 Wired1 is offline
 
Join Date: Nov 2003
Location: Orlando, FL, USA
Posts: 1,361
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default auto-creating a forum?

Does anyone know of a way of auto-creating a forum, other than a normal mySQL command? Looking for the vB function, if it exists.
Reply With Quote
  #2  
Old 02-11-2004, 03:05 AM
Andreas's Avatar
Andreas Andreas is offline
 
Join Date: Jan 2004
Location: Germany
Posts: 6,863
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

AFAIK there is none.

A draft code could be (not tested)

PHP Code:
require_once('./includes/functions_misc.php');
require_once(
'./includes/adminfunctions_forums.php');
$forum = array(
        
'parentid' => $parentid,
        
'title' => 'Some foobar title',
        
'description' => 'Some foobar description'
);
$parentlist fetch_forum_parentlist($forum['parentid']);
$DB_site->query(fetch_query_sql($forum'forum'));

$forumid $DB_site->insert_id();
$DB_site->query("
        UPDATE " 
TABLE_PREFIX "forum
        SET parentlist='" 
addslashes("$forumid,$parentlist") . "',
        childlist = '
$forumid,-1'
        WHERE forumid = 
$forumid
"
);

build_forum_permissions(); 
Reply With Quote
  #3  
Old 02-11-2004, 01:32 PM
Xenon's Avatar
Xenon Xenon is offline
 
Join Date: Oct 2001
Location: Bavaria
Posts: 12,878
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

PHP Code:
$DB_site->query(fetch_query_sql($forum'forum')); 
that's the important part
Reply With Quote
  #4  
Old 02-12-2004, 02:06 AM
Wired1's Avatar
Wired1 Wired1 is offline
 
Join Date: Nov 2003
Location: Orlando, FL, USA
Posts: 1,361
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

This is interesting...
Code:
function fetch_forum_parentlist($forumid)
{
global $DB_site;

if ($forumid == -1)
{
	return '-1';
}

$foruminfo = $DB_site->query_first("SELECT parentid FROM " . TABLE_PREFIX . "forum WHERE forumid = $forumid");

$forumarray = $forumid;

if ($foruminfo['parentid'] != 0)
{
	$forumarray .= ',' . fetch_forum_parent_list($foruminfo['parentid']);
}

if (substr($forumarray, -2) != -1)
{
	$forumarray .= '-1';
}

	return $forumarray;
}
Look at this snippet of that function:
Code:
	if ($foruminfo['parentid'] != 0)
{
	$forumarray .= ',' . fetch_forum_parent_list($foruminfo['parentid']);
}
fetch_forum_parentlist is the name of the function, but it refers to fetch_forum_parent_list ... that function doesn't exist, yet the admin section sub-forum thing works just fine from the admin CP. I'm using RC3, can anyone confirm if this was a bug intro'd in RC3, or was it fixed in RC4?
Reply With Quote
  #5  
Old 02-12-2004, 02:48 AM
Andreas's Avatar
Andreas Andreas is offline
 
Join Date: Jan 2004
Location: Germany
Posts: 6,863
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

It does exist - in functions.php. Doh!
Reply With Quote
  #6  
Old 02-12-2004, 03:11 AM
Wired1's Avatar
Wired1 Wired1 is offline
 
Join Date: Nov 2003
Location: Orlando, FL, USA
Posts: 1,361
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Well, I got it to work, except that Display Order = 0 and every setting except for Apply This Password to Child Forums is set to 0. This setup is not the default. If I'm reading it correct, build_forum_permissions(); is supposed to use the defaults? I'd like for it to use the defaults of the site, or the forum it is a sub-forum of. Here's the code so far:
PHP Code:
require_once('./global.php'); 
require_once(
'./includes/functions_misc.php'); 
require_once(
'./includes/adminfunctions_forums.php'); 
require_once(
'./includes/adminfunctions.php');

$foruminfo = array( 
        
'parentid' => 10
        
'title' => 'Some foobar title'
        
'description' => 'Some foobar description' 
); 

$parentlist fetch_forum_parentlist($foruminfo['parentid']); 
$DB_site->query(fetch_query_sql($foruminfo'forum')); 

$forumid $DB_site->insert_id(); 
$DB_site->query(
        UPDATE " 
TABLE_PREFIX "forum 
        SET parentlist='" 
addslashes("$forumid,$parentlist") . "', 
        childlist = '
$forumid,-1' 
        WHERE forumid = 
$forumid 
"
); 

build_forum_permissions(); 
Reply With Quote
  #7  
Old 02-14-2004, 04:27 AM
Wired1's Avatar
Wired1 Wired1 is offline
 
Join Date: Nov 2003
Location: Orlando, FL, USA
Posts: 1,361
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Is build_forum_permissions(); is supposed to use the forum defaults?
Reply With Quote
  #8  
Old 02-15-2004, 11:25 PM
Wired1's Avatar
Wired1 Wired1 is offline
 
Join Date: Nov 2003
Location: Orlando, FL, USA
Posts: 1,361
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

No one knows? I'm about to update to RC4 to see if they've put in any comments for this function, crossing my fingers for the moment, unless someone else knows.

Update: Nope, RC4 didn't help
Reply With Quote
  #9  
Old 02-22-2004, 08:18 AM
Wired1's Avatar
Wired1 Wired1 is offline
 
Join Date: Nov 2003
Location: Orlando, FL, USA
Posts: 1,361
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Blatant BUMP...... If I can get this auto forum script to work, I can finally put the pieces of my site together.... PLEASEEEEEEEEEEEEEEEE

Yes, I'm desperate enough to whine
Reply With Quote
  #10  
Old 07-30-2006, 04:46 PM
aspen0 aspen0 is offline
 
Join Date: Apr 2003
Posts: 65
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Anyone ever figure this out? I keep getting this error:

Database error in vBulletin 3.0.6:

Invalid SQL: SELECT parentid FROM forum WHERE forumid =
mysql error: You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 1

mysql error number: 1064

I'm using the same exact code.
Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 03:01 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.04062 seconds
  • Memory Usage 2,269KB
  • Queries Executed 13 (?)
More Information
Template Usage:
  • (1)SHOWTHREAD
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)ad_showthread_beforeqr
  • (1)ad_showthread_firstpost
  • (1)ad_showthread_firstpost_sig
  • (1)ad_showthread_firstpost_start
  • (2)bbcode_code
  • (3)bbcode_php
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)navbar
  • (3)navbar_link
  • (120)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (1)pagenav_pagelink
  • (10)post_thanks_box
  • (10)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (10)post_thanks_postbit_info
  • (10)postbit
  • (10)postbit_onlinestatus
  • (10)postbit_wrapper
  • (1)spacer_close
  • (1)spacer_open
  • (1)tagbit_wrapper 

Phrase Groups Available:
  • global
  • inlinemod
  • postbit
  • posting
  • reputationlevel
  • showthread
Included Files:
  • ./showthread.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/functions_bigthree.php
  • ./includes/class_postbit.php
  • ./includes/class_bbcode.php
  • ./includes/functions_reputation.php
  • ./includes/functions_post_thanks.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
  • showthread_start
  • showthread_getinfo
  • forumjump
  • showthread_post_start
  • showthread_query_postids
  • showthread_query
  • bbcode_fetch_tags
  • bbcode_create
  • showthread_postbit_create
  • postbit_factory
  • postbit_display_start
  • post_thanks_function_post_thanks_off_start
  • post_thanks_function_post_thanks_off_end
  • post_thanks_function_fetch_thanks_start
  • post_thanks_function_fetch_thanks_end
  • post_thanks_function_thanked_already_start
  • post_thanks_function_thanked_already_end
  • fetch_musername
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • pagenav_page
  • pagenav_complete
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete