Kunena 6.3.1 released

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

Please note: The Kunena project team takes NO responsibility for maintaining nor supporting anything in this category.

Question Add Phone and Address fields in posting

More
8 years 1 month ago - 8 years 1 month ago #1 by shawnhy
Hi,
I want to add two fields, phone number and Home address alike "e-mail" form when composing a post.



Edit [J!]/administrator/components/com_kunena/models/config.php ,about line 148, add
Code:
$lists ['showphone'] = JHtml::_('select.genericlist', $yesno, 'cfg_showphone', 'class="inputbox" size="1"', 'value', 'text', $this->config->showphone); $lists ['askphone'] = JHtml::_('select.genericlist', $yesno, 'cfg_askphone', 'class="inputbox" size="1"', 'value', 'text', $this->config->askphone); $lists ['showaddress'] = JHtml::_('select.genericlist', $yesno, 'cfg_showaddress', 'class="inputbox" size="1"', 'value', 'text', $this->config->showaddress); $lists ['askaddress'] = JHtml::_('select.genericlist', $yesno, 'cfg_askaddress', 'class="inputbox" size="1"', 'value', 'text', $this->config->askeaddress);
And file [J!]/administrator/components/com_kunena/template/joomla30/config/default.php, about line 473
Code:
<tr> <td>Phone no. required</td> <td><?php echo $this->lists ['askphone'] ?></td> <td><?php echo JText::_('COM_KUNENA_A_ASK_EMAIL_DESC') ?></td> </tr> <tr> <td>Phone number</td> <td><?php echo $this->lists ['showphone'] ?></td> <td><?php echo JText::_('COM_KUNENA_A_SHOWMAIL_DESC') ?></td> </tr> <tr> <td>Home Address required</td> <td><?php echo $this->lists ['askaddress'] ?></td> <td><?php echo JText::_('COM_KUNENA_A_ASK_EMAIL_DESC') ?></td> </tr> <tr> <td>Home Address</td> <td><?php echo $this->lists ['showaddress'] ?></td> <td><?php echo JText::_('COM_KUNENA_A_SHOWMAIL_DESC') ?></td> </tr>
So far, we see 2 fields add and configurable in admin.



then I add code in file [J!]/components/com_kunena/template/blue_eagle/html/topic/edit.php
To make field visible to customers.
Code:
<?php if ($this->config->askphone) : ?> <tr class = "krow<?php echo 1+ $this->k^=1 ?>"> <td class = "kcol-first"><strong>Phone No.*</strong></td> <td class="kcol-mid"> <input type="text" id="phone" name="phone" size="35" class="kinputbox postinput required validate-phone" maxlength="35" value="<?php echo !empty($this->message->phone) ? $this->escape($this->message->phone) : '' ?>" /> <br /> <?php echo $this->config->showphone == '0' ? JText::_('COM_KUNENA_POST_EMAIL_NEVER') : JText::_('COM_KUNENA_POST_EMAIL_REGISTERED'); ?> </td> </tr> <?php endif; ?> <?php if ($this->config->askaddress ) : ?> <tr class = "krow<?php echo 1+ $this->k^=1 ?>"> <td class = "kcol-first"><strong>Home Address*</strong></td> <td class="kcol-mid"> <input type="text" id="address" name="address" size="35" class="kinputbox postinput required validate-address" maxlength="35" value="<?php echo !empty($this->message->address) ? $this->escape($this->message->address) : '' ?>" /> <br /> <?php echo $this->config->showaddress == '0' ? JText::_('COM_KUNENA_POST_EMAIL_NEVER') : JText::_('COM_KUNENA_POST_EMAIL_REGISTERED'); ?> </td> </tr> <?php endif; ?>



Now users are required to fill phone number and Home address and they should be seen by administrator only.

If we submit a testing post, of course administrator cannot get my hone and address, because there is no where to store these 2 values in the database. So I add two column in kunena_messages

My question is : how to write values into database?
I tried editing [J!]/components/com_kunena/controllers/topic.php but not success.

Thank you for helping
Attachments:
Last edit: 8 years 1 month ago by shawnhy. Reason: formatting

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

Time to create page: 0.473 seconds