×
Kunena 5.1 RC 3 Released (16 Feb 2018)

The Kunena team is proud to announce the arrival of Kunena 5.1.0 RC3 [K 5.1.0] which is now available for download as a native Joomla extension for J! 3.8.x. This version addresses most of the issues that were discovered in K 5.1 and issues discovered during the development stages of K 5.1. This is a RC release.

× Seeking help from others in the community in relation to very specific, custom forum needs. It is assumed that people who post in this category are prepared to offer payment for any help they may obtain. Please include information that allows other people to contact you (e.g. your email address).

If you simply want to know if something is possible, use the General Questions and How-tos category.

Notes:
  1. The material in this category is not verified by the Kunena Project team for usability with any version of Kunena. People who use information here do so at their own risk. The project team takes NO responsibility for maintaining or supporting anything in this category.
  2. If you are not offering money to pay for your custom needs, please use the category Custom work - not offering to pay (registered users only).
  3. Topics not resolved in 3 months will be closed and locked

Question Add Phone and Address fields in posting

More
1 year 10 months ago #1 by shawnhy
shawnhy created the topic: Add Phone and Address fields in posting
Hi,
I want to add two fields, phone number and Home address alike "e-mail" form when composing a post.
You can contact me to make quotation by skype:yao0901



Edit [J!]/administrator/components/com_kunena/models/config.php ,about line 148, add
$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
<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.
<?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

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

  • Not Allowed: to create new topic.
  • Not Allowed: to reply.
  • Not Allowed: to add attachements.
  • Not Allowed: to edit your message.
Time to create page: 0.133 seconds