Hi, I've had a good look around the internet and have found a couple of topics on these forums about making the output from ChronoForms create a paste into a topic in a certain category within a FireBoard Forum.
I have managed to get the form to create a topic (using the correct user) with the correct topic subject, but when I cannot get the message (which will show the data input into the form) to show up. Also fireboard doesn't recognise there being a new post, nor does it show the post as even existing on the main forum page. What I mean by that if i didn't make it clear is when you are on the main forum page, if you scroll down to "Applications" where the form places all of its submissions, fireboard shows there as being NO topics.. even though when you click it there are topics in there.
Here is my code which I copied and edited from another topic on this forum:
So I was wondering if anyone could help me make the message show up in the forum, and make the forum realise that there is new topics in there.
I am using Joomla 1.5.7, ChronoForms 3.0 (STABLE) and Fireboard 1.0.5RC2.
Thanks,
Arron
I have managed to get the form to create a topic (using the correct user) with the correct topic subject, but when I cannot get the message (which will show the data input into the form) to show up. Also fireboard doesn't recognise there being a new post, nor does it show the post as even existing on the main forum page. What I mean by that if i didn't make it clear is when you are on the main forum page, if you scroll down to "Applications" where the form places all of its submissions, fireboard shows there as being NO topics.. even though when you click it there are topics in there.
Here is my code which I copied and edited from another topic on this forum:
<?php
// :: Remove all this Joomla will handle it for you
// $db_host = "knightsoftheroseguild.com";
// $db_user = "xxxxxx";
// $db_pwd = "xxxxxx";
// $db_name = "joomla";
// mysql_connect($db_host, $db_user, $db_pwd);
// mysql_select_db($db_name);
// :: here's now you call the database
global $mainframe;
$database =& JFactory::getDBO();
// :: set some variables that may need to be changed
$catid = 67;
$userid = 71;
$author = "Application Form";
$fieldname = 'field_name';
$subject = $_POST['char_name']." New Application Form! ".$_POST['class'];
$date = strtotime("now");
// $_POST['armory'] = "[URL=".$_POST['armory']."]LINK[/URL]";
$_POST[$fieldname] = "[url=".$_POST[$fieldname]."]LINK[/url]";
foreach($_POST as $key => $value) {
// capitalize the first letter of each field
$key = ucfirst($key);
//make the title bold
$key = "".$key."";
//make it part of the msg string
$msg = "$msg $key : $value";
}
// get rid of the submit button bit at the end
$msg_array = explode("[b]Button", $msg);
$msg = $msg_array[0];
/* $msg = substr($msg, 0, -3); */
// Because I'm lazy ...
// :: I'm not sure this is correct - needs testing
$msg = str_replace("\n","\n\n",$msg);
// Create the new topic
$sql = "
INSERT
INTO #__fb_messages
SET id=NULL, parent=0, thread=0, catid=$catid,
name='$author', userid=$userid, email=NULL,
subject='$subject', time=$date, ip=NULL";
$database->setQuery($sql);
if ( !$database->query() ) {
echo "<script> alert('".$database->getErrorMsg()."');
window.history.go(-1); </script>";
}
// Figure out what the correct threadid is of that new topic
$mesid = $database->insertid;
// Set the thread id to the same as the message id,
// as it's the first in the thread
// Note: this solves the order problem in the forum
$sql = "
UPDATE #__fb_messages
SET thread=id
WHERE id=$mesid";
$database->setQuery($sql);
if ( !$database->query() ) {
echo "<script> alert('".$database->getErrorMsg()."');
window.history.go(-1); </script>";
}
// Tell the forum that there's a new latest message
// Note: this solves the problem where the new message
// isn't showing up as the latest message in the forum
// Note: it's the categories table because FB sees
// categories and forums as the same thing
$sql = "
UPDATE #__fb_categories
SET id_last_msg=$mesid
WHERE id=$catid";
$database->setQuery($sql);
if ( !$database->query() ) {
echo "<script> alert('".$database->getErrorMsg()."');
window.history.go(-1); </script>";
}
// Stick the $msg variable into the body of the topic
$sql = "
INSERT INTO #__fb_messages_text
SET mesid=$mesid, message='This is a test, used to be dollarmsg.'";
$database->setQuery($sql);
if ( !$database->query() ) {
echo "<script> alert('".$database->getErrorMsg()."');
window.history.go(-1); </script>";
}
?>
So I was wondering if anyone could help me make the message show up in the forum, and make the forum realise that there is new topics in there.
I am using Joomla 1.5.7, ChronoForms 3.0 (STABLE) and Fireboard 1.0.5RC2.
Thanks,
Arron