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

Reply
 
Thread Tools Display Modes
  #51  
Old 11-09-2004, 05:38 PM
Gryphon's Avatar
Gryphon Gryphon is offline
 
Join Date: Oct 2001
Location: Seattle, WA
Posts: 617
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

This thread has been very helpful, though I am having some trouble. Here is the my current code:

PHP Code:
if ($_POST["action"] == 'add') {
  
query("INSERT INTO psu_news SET author='$user[name]', title='$_POST[title]', date_added='$setting[time]', post_id='$_POST[post_id]'");
  
$psu_news_id mysql_insert_id();

  if (
$_POST["create_post"] == '1' && $_POST["post_id"] == '0') {
    
// vb functions
    
chdir('/home/psuwww/wwwroot/site.com/forums');
    require(
'./global.php');
    require(
'./includes/functions_newpost.php');

    
$userid 5// The user creating the thread
    
$forumid 2// The forum where the thread is to be posted

    // forum & user info
    
$foruminfo fetch_foruminfo($forumid);
    
$bbuserinfo fetch_userinfo($userid);

    
// setup the thread
    
$post[title] = '[News] '.$_POST["title"].'';
    
$post[message] = '[url=http://www.site.com/index.php?newsid='.$psu_news_id.']http://www.site.com/index.php?newsid='.$psu_news_id.'[/url]';
    
$post[poststarttime] = TIMENOW;
    
$post[posthash] = md5($post[poststarttime] . $bbuserinfo['userid'] . $bbuserinfo['salt']);
    
$post[emailupdate] = 9999;

    
// build the thread
    
build_new_post('thread'$foruminfo, array(), 0$post$errors);

    
// bome back to working dir
    
chdir('/home/psuwww/wwwroot/site.com/admin');
    
query("UPDATE psu_news SET post_id='$post[threadid]' WHERE id='$psu_news_id'");
  }
  echo 
'<hr><font size="3"><b>Post Added '.$psu_news_id.'</b><hr>';

The Thread title posts correctly and the Message also posts, however, $psu_news_id becomes unset. The message url in the created thread is missing the $psu_news_id and the final echo is blank.

Also, this is all done mid template on our site, and all the variables pre-defined at the top of the script are unset after this.

Any info appreciated.
Reply With Quote
  #52  
Old 11-11-2004, 04:00 PM
Gryphon's Avatar
Gryphon Gryphon is offline
 
Join Date: Oct 2001
Location: Seattle, WA
Posts: 617
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

That is too bad
Reply With Quote
  #53  
Old 11-11-2004, 04:15 PM
sabret00the's Avatar
sabret00the sabret00the is offline
 
Join Date: Jan 2003
Location: London
Posts: 5,268
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

i would love something like this based on

if posts on the forums in XX hours < XX then create thread
Reply With Quote
  #54  
Old 11-15-2004, 07:38 PM
zeropaid's Avatar
zeropaid zeropaid is offline
 
Join Date: Nov 2004
Location: San Diego, CA
Posts: 62
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I am also having problems creating posts... here is my code:

PHP Code:
 chdir('/usr/local/www/htdocs/bbs');

// Load vB-Backend
require('./global.php');
require('/includes/functions_newpost.php');

$userid = $_POST[news_user_id]; // The user creating the thread
$forumid = 120; // The forum where the thread should be posted

// Get forum & user info
$foruminfo = fetch_foruminfo($forumid);
$bbuserinfo = fetch_userinfo($userid);

// Setup the thread
$post[title] = $title;
$post[message] = $article;
$post[poststarttime] = TIMENOW;
$post[posthash] = md5($post[poststarttime] . $bbuserinfo['userid'] . $bbuserinfo['salt']);
$post[emailupdate] = 9999;

// build the thread
build_new_post('thread', $foruminfo, array(), 0, $post, $errors);

// Errors?
if (sizeof($errors) > 0) {
  ?>There have been errors. <?=$errors?><?
  print_r($errors);
  die('errors');
}

$ThreadID = $post['threadid'];
$PostID = $post['postid'];

print ("the threadid is $ThreadID and the postid is $PostID");
And I get back these errors:

Warning: array_merge() [function.array-merge]: Argument #2 is not an array in /usr/local/www/htdocs/bbs/includes/init.php on line 517

Fatal error: Call to a member function query_first() on a non-object in /usr/local/www/htdocs/bbs/includes/functions.php on line 922

Any help is appreciated, kind of lost here.

Thanks!
Reply With Quote
  #55  
Old 11-15-2004, 08:13 PM
Gryphon's Avatar
Gryphon Gryphon is offline
 
Join Date: Oct 2001
Location: Seattle, WA
Posts: 617
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Might be
PHP Code:
require('./includes/functions_newpost.php'); 
Reply With Quote
  #56  
Old 11-15-2004, 08:52 PM
zeropaid's Avatar
zeropaid zeropaid is offline
 
Join Date: Nov 2004
Location: San Diego, CA
Posts: 62
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

yep fixed that and i think it would have complained about not being able to find the file... still not working. Maybe something in the data I am passing to it, hmm
Reply With Quote
  #57  
Old 11-15-2004, 11:37 PM
zeropaid's Avatar
zeropaid zeropaid is offline
 
Join Date: Nov 2004
Location: San Diego, CA
Posts: 62
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

tried passing it vanilla test data, to no avail. I am logged into the forum and that got rid of one of the errors, but now all I get is:

Warning: array_merge() [function.array-merge]: Argument #2 is not an array in /usr/local/www/htdocs/bbs/includes/init.php on line 517

I checked init.php and it is trying to merge an array it just created and $specialtemplates, which appears to not be defined. This is a dev environment, maybe we are missing some templates?
Reply With Quote
  #58  
Old 11-16-2004, 01:27 PM
sabret00the's Avatar
sabret00the sabret00the is offline
 
Join Date: Jan 2003
Location: London
Posts: 5,268
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

has this been released properly?
Reply With Quote
  #59  
Old 11-16-2004, 03:40 PM
zeropaid's Avatar
zeropaid zeropaid is offline
 
Join Date: Nov 2004
Location: San Diego, CA
Posts: 62
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

released properly? I upgraded properly if thats what you mean, to 3.0.3
Reply With Quote
  #60  
Old 11-16-2004, 05:03 PM
sabret00the's Avatar
sabret00the sabret00the is offline
 
Join Date: Jan 2003
Location: London
Posts: 5,268
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

i mean did i get released via the releases forum here at vb.org?
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 02:20 AM.


Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2024, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.07101 seconds
  • Memory Usage 2,276KB
  • Queries Executed 11 (?)
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
  • (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
  • (4)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