Kunena 7.0.8 Released

The Kunena team has announce the arrival of Kunena 7.0.8 [K 7.0.8] in stable which is now available for download as a native Joomla extension for J! 5.4.x/6.0.x./6.1.x. This version addresses most of the issues that were discovered in K 6.2 / K 6.3 / K 6.4 and issues discovered during the last development stages of K 7.0

Topics that are moved into this category are generally considered to be closed. Users may want to add additional information but these topics should not be resurrected in order to discuss new problems or unrelated matters.

Question Custom Field for Thread

More
17 years 1 month ago #24401 by synectic
I'm trying to add a custom field for threads in a specific category.

I've added a field to the database table fb_messages. I've setup a url to pass the value of the custom field to the create a new message form:

index.php?option=com_kunena&Itemid=10&func=post&do=reply&catid=8&myfld=439'

I've modified the fb_write.html.php file to include the custom field as a hidden form input.

<input type="text" name="myfld" value="<?php echo $_GET; ?>" />

I've also verified that the value is getting to the form by outputting the value to the page.

Now, the part that's not working. I've modified the code in post.php to insert the custom field into the database, but it's not getting the value to the insert code:

$kunena_db->setQuery("INSERT INTO #__fb_messages
(myfld,parent,thread,catid,name,userid,email,subject,time,ip,topic_emoticon,hold)
VALUES('$myfld','$parent','$thread','$catid','$fb_authorname','{$kunena_my->id}','$email','$subject','$posttime','$ip','$topic_emoticon','$holdPost')");

Is there a transfer of variables somewhere in the code that I'm missing? Everything else posts to the database just fine, just the myfld isn't populated from the form to the database?

Please Log in or Create an account to join the conversation.

More
17 years 1 month ago #24410 by xillibit
Replied by xillibit on topic Re:Custom Field for Thread
synectic wrote:


Now, the part that's not working. I've modified the code in post.php to insert the custom field into the database, but it's not getting the value to the insert code:

$kunena_db->setQuery("INSERT INTO #__fb_messages
(myfld,parent,thread,catid,name,userid,email,subject,time,ip,topic_emoticon,hold)
VALUES('$myfld','$parent','$thread','$catid','$fb_authorname','{$kunena_my->id}','$email','$subject','$posttime','$ip','$topic_emoticon','$holdPost')");

Is there a transfer of variables somewhere in the code that I'm missing? Everything else posts to the database just fine, just the myfld isn't populated from the form to the database?

Hello,

you need before to insert the datas in the database, to get the value of your variable $myfld like this :
Code:
$myfld= JRequest::getVar('myfld', '');

I don't provide support by PM, because this can be useful for someone else.

Please Log in or Create an account to join the conversation.

Time to create page: 0.202 seconds