ChronoEngine Forums
Welcome, Guest
Please Login or Register.    Lost Password?
auto exporting data into forums (1 viewing) (1) Guest
Go to bottom Post Reply Favoured: 0
TOPIC: auto exporting data into forums
#8193
GreyHead (Admin)
Admin
Posts: 2197
graph
User Online Now Click here to see the profile of this user
Re:auto exporting data into forums 6 Days, 8 Hours ago Karma: 44  
Hi wingnut110,

That's what the confuzzled.nl code is for . . .

Bob
 
Report to moderator   Logged Logged  
 
Bob Janes
info at greyhead.net
ChronoForms Support If you like ChronoForms please vote or post a review at Joomla.org
  The administrator has disabled public write access.
#8195
wingnut110 (User)
Fresh Boarder
Posts: 9
graphgraph
User Offline Click here to see the profile of this user
Re:auto exporting data into forums 6 Days, 8 Hours ago Karma: 0  
Hiya Bob,

Ya, I understand that. What i meant, and should have said rather is that i cannot get it to actually write to the fireboard tables. It's just not getting there. I can execute the sql queries from the code on my database and it writes the info to the fb tables. I'm thinking it may be not connecting to the database?

Here is the code that I have now..
Code:

$value) { // capitalize the first letter of each field $key = ucfirst($key); //make the title bold $key = "[b]".$key."[/b]"; //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 ... $msg=str_replace(" “,”\n\n”,$msg); // Create the new topic $create_thread = "INSERT INTO `joomla`.`jos_fb_messages` SET id=NULL, parent=0, thread=0, catid=43, name='$author', userid=328, email=NULL, subject='$subject', time=$date, ip=NULL"; mysql_query($create_thread) or die(mysql_error()); // Figure out what the correct threadid is of that new topic $mesid=mysql_insert_id(); // 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 $set_thread="update jos_fb_messages set thread=id where id=$mesid"; mysql_query($set_thread) or die(mysql_error()); // 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 $set_forum="update jos_fb_categories set id_last_msg=$mesid where id=43"; mysql_query($set_forum) or die(mysql_error()); // Stick the $msg variable into the body of the topic $insert_msg="INSERT INTO `joomla`.`jos_fb_messages_text` SET mesid=$mesid, message='$msg'"; mysql_query($insert_msg) or die(mysql_error()); ?>
I did a little investigation and changed the catid, userid and such... like I said, works as individual sql queries, just not all together.. not sure if it's not connecting to the database, if chronoforms just dont like doing it this way, or maybe it's just put together incorrectly.
 
Report to moderator   Logged Logged  
 
Last Edit: 2008/05/10 05:43 By GreyHead.
  The administrator has disabled public write access.
#8196
GreyHead (Admin)
Admin
Posts: 2197
graph
User Online Now Click here to see the profile of this user
Re:auto exporting data into forums 6 Days, 5 Hours ago Karma: 44  
Hi wingnut110,

Ok, we'll clean this up a bit and turn it into Joomla-style code on the way. Which version of Joomla are you using? (1.0.x and 1.5 have different code syntaxes.)

Bob
 
Report to moderator   Logged Logged  
 
Bob Janes
info at greyhead.net
ChronoForms Support If you like ChronoForms please vote or post a review at Joomla.org
  The administrator has disabled public write access.
#8209
wingnut110 (User)
Fresh Boarder
Posts: 9
graphgraph
User Offline Click here to see the profile of this user
Re:auto exporting data into forums 5 Days, 22 Hours ago Karma: 0  
Hi Bob,

I am using joomla 1.0.12 Thank you for your patience and help I know just enough about this stuff to be dangerous..lol but I guess this is how one learns


Luke
 
Report to moderator   Logged Logged  
  The administrator has disabled public write access.
#8228
GreyHead (Admin)
Admin
Posts: 2197
graph
User Online Now Click here to see the profile of this user
Re:auto exporting data into forums 5 Days, 6 Hours ago Karma: 44  
Hi Luke,

Here's a re-written version for Joomla 1.0.x. I've added a few comments prefixed '::'.
Code:

$value) { // capitalize the first letter of each field $key = ucfirst($key); //make the title bold $key = "[b]".$key."[/b]"; //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 ""; } // 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 ""; } // 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 ""; } // Stick the $msg variable into the body of the topic $sql = " INSERT INTO #__fb_messages_text SET mesid=$mesid, message='$msg'"; $database->setQuery($sql); if ( !$database->query() ) { echo ""; } ?>
I've pulled some variables into a config block at the beginning and have changed all the database code to use Joomla syntax. I have one query with the line
Code:

$msg = str_replace("\n","\n\n",$msg);
which is doing some newline cleanup. It was broken in confuzzled's example because it included a newline character of some kind. This may need tweaking to give a tidy result. Not tested so may need some debugging. Bob
 
Report to moderator   Logged Logged  
 
Last Edit: 2008/05/11 04:43 By GreyHead.
 
Bob Janes
info at greyhead.net
ChronoForms Support If you like ChronoForms please vote or post a review at Joomla.org
  The administrator has disabled public write access.
#8246
wingnut110 (User)
Fresh Boarder
Posts: 9
graphgraph
User Offline Click here to see the profile of this user
Re:auto exporting data into forums 4 Days, 20 Hours ago Karma: 0  
Hiya Bob,

Thank you for your rework
It is now creating a thread in the correct place, and the topic is correct, although the message body is not getting there. The forum post shows this error in the message body:

Warning: Invalid argument supplied for foreach() in /home/.randie/jasmindria/knightsoftheroseguild.com/components/com_fireboard/template/default/view.php on line 1871

the code is writing to the jos_fb_messages, it is updating the jos_fb_categories, but its not writing to the jos_fb_messages_text .

I am assuming the problem lies in

// Stick the $msg variable into the body of the topic
$sql = "
INSERT INTO #__fb_messages_text
SET mesid=$mesid, message='$msg'";
$database->setQuery($sql);
if ( !$database->query() ) {
echo "";


also, not exactly sure why you changed

$_POST['armory'] = "LINK";

to

$_POST[$fieldname] = "LINK";

armory is the field name.. just curious

thank you for your help it's getting there!
 
Report to moderator   Logged Logged  
  The administrator has disabled public write access.
Go to top Post Reply
Powered by FireBoardget the latest posts directly to your desktop


equalheight If you have any questions you can post to our forums and we will be glad to help ASAP

Members Login






Lost Password?
No account yet? Register

2CheckOut.com Inc. (Ohio, USA) is an authorized retailer for
goods and services provided by ChronoEngine.com

ChronoForms License

equalheightTo be able to continue working at this component we decided to get a small profit out of it but at the same time don't force everybody to pay in order to use this great component.

 

 From version 1.5 and up a link at the bottom of everyform created will be placed, saying "joomla professional work", the link will be to us here htttp://www.chronoengine.com, its illegal to remove this link from the source code unless you have a license,

so the license is very simply for the same ChronoForms component without a link, thats all!

This License is for 5 different websites ONLY. 

 

 However, in order to allow everybody to still use the component and even get out of this, the link is inside a div with class : chronoform , use this to hide the link by using different colors or whatever if you really can't pay, but of course the link is still exists at your page source.

 

The license is ONLY 25$ can be bought here :

 

Thank you!

 

ChronoEngine.com Team 

Joomla Templates and Joomla Tutorials