Log in

View Full Version : auto creation not possible in 3.0.7?


AN-net
03-01-2005, 11:17 PM
my thread auto creating code worked in 3.0.3 but now it doesnt at all, y?

here is my code:

global $bbuserinfo, $DB_site, $vboptions, $vbphrase;
require_once('./includes/functions_newpost.php');
$forumid = 2;
$foruminfo = fetch_foruminfo($forumid);
$post['title'] = "Discuss: ".$newstitle."";
$strippedtext= strip_bbcode($newstext, FALSE, TRUE);
if(strlen($strippedtext) > 350)
{
$shortenedtext= substr($strippedtext, 0, 347);
$shortenedtext.= "...";
}
else
{
$shortenedtext= $strippedtext;
}
$newsdate= vbdate($vboptions['dateformat'], $newsdate);
$articleurl= "".$vboptions['bburl']."/news/newsarticle".$articleid.".html";
$image= "".$vboptions['bburl']."/images/news/news".$articleid."_medium.".$extension."";
$post['message'] = construct_phrase($vbphrase['news_post_content'], $image, $newstitle, $newsdate, $user['userid'], $user['username'], $shortenedtext, $articleurl);
$post['poststarttime'] = $newsdate;
$post['posthash'] = md5($post['poststarttime'] . $user['userid'] . $user['salt']);
build_new_post('thread', $foruminfo, array(), 0, $post, $errors);
$DB_site->query("UPDATE ".TABLE_PREFIX."news SET threadid=".intval($post['threadid']).", postid=".intval($post['postid'])." WHERE news_id=".intval($articleid)."");


everything has gone wrong since i upgraded!!!!!!

Paul M
03-02-2005, 06:50 AM
Apart from a few minor changes (like tag stripping) there is no difference between functions_newpost in 3.0.3 and 3.0.7. It should work perfectly (and does in several hacks for me).

About the only thing that can stop a thread being created is if the hash matches an existing one - meaning it fails as a duplicate.

AN-net
03-02-2005, 11:21 AM
well i dont see how my posthash is incorrect, could it be that my news script is in a separate directory from vb so it thinks it coming from an outside source. cause i have no clue

anyone?

bump

AN-net
03-03-2005, 06:41 PM
anyone have an idea?

AN-net
03-06-2005, 07:06 AM
does anyone have an idea why this code is broke? please this is really important to me.

Paul M
03-06-2005, 09:30 AM
There is nothing wrong with that code that I can see. You don't give enough information to help further. How are you running it ? What is the error ? are you sure it actually runs (is their more code around it that may be broken) ?

I doubt anyone could really tell you what's wrong without access to your site to perform debugging.

AN-net
03-06-2005, 01:49 PM
there is no error, it runs as a function


//***********************************************
//Create Discussion Thread
function build_discussion_thread($articleid, $newstitle, $newstext, $newsdate, $extension, $user)
{
global $bbuserinfo, $DB_site, $vboptions, $vbphrase;
require_once('./includes/functions_newpost.php');
$forumid = 2;
$foruminfo = fetch_foruminfo($forumid);
$post['title'] = "Discuss: ".$newstitle."";
$strippedtext= strip_bbcode($newstext, FALSE, TRUE);
if(strlen($strippedtext) > 350)
{
$shortenedtext= substr($strippedtext, 0, 347);
$shortenedtext.= "...";
}
else
{
$shortenedtext= $strippedtext;
}
$newsdate= vbdate($vboptions['dateformat'], $newsdate);
$articleurl= "".$vboptions['bburl']."/news/newsarticle".$articleid.".html";
$image= "".$vboptions['bburl']."/images/news/news".$articleid."_medium.".$extension."";
$post['message'] = construct_phrase($vbphrase['news_post_content'], $image, $newstitle, $newsdate, $user['userid'], $user['username'], $shortenedtext, $articleurl);
$post['poststarttime'] = $newsdate;
$post['posthash'] = md5($post['poststarttime'] . $bbuserinfo['userid'] . $bbuserinfo['salt']);
build_new_post('thread', $foruminfo, array(), 0, $post, $errors);
$DB_site->query("UPDATE ".TABLE_PREFIX."news SET threadid=".intval($post['threadid']).", postid=".intval($post['postid'])." WHERE news_id=".intval($articleid)."");
echo "built thread!";
}

that is the function

i dont know what else to post because everything around it works...

AN-net
03-07-2005, 09:13 PM
anyone have a solution or maybe post code they use?

AN-net
03-09-2005, 01:33 AM
please can someone help!!! this is so dire to me!!!

Marco van Herwaarden
03-09-2005, 08:05 AM
If i don't forget (which is very likely) i will have a look tomorrow.

sabret00the
03-09-2005, 10:11 AM
i know this really don't help but $post['title'] = "Discuss: ".$newstitle.""; only needs to be $post['title'] = "Discuss: ".$newstitle; :)

AN-net
03-09-2005, 11:15 AM
i know this really don't help but $post['title'] = "Discuss: ".$newstitle.""; only needs to be $post['title'] = "Discuss: ".$newstitle; :)
thanks but it can be done that way and thats usually how i code lol but thanks for your suggestion:)

ok after some echo debugging it comes down to this line in functions_newpost.php


if ($post['preview'] OR sizeof($errors) > 0)
{
echo "error or preview";
// preview or errors, so don't submit
return;
}

for some reason it thinks that it has errors or it is a preview...

i have set these variables to this in my custom function for running build_new_post():

$post['preview']= '';
$errors= array();

and it still thinks test are errors or a preview

AN-net
03-10-2005, 09:30 PM
ok well im still clueless, any ideas?

AN-net
03-12-2005, 02:15 AM
please comeon, ive narrowed it down so much!! someone help:(

fixed my problem turns out my vbphrase was reset when i upgraded!